Jump to content

garyed

Members
  • Posts

    160
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

garyed's Achievements

Advanced Member

Advanced Member (4/5)

1

Reputation

  1. If I use either of these statements, the result is the same. Joe has ([\d.]+) large apples Joe has (\d.+) large apples It doesn't seem to matter whether I put the square brackets in or not. Are those brackets are there for a reason beyond the scope of the usage in this particular statement?
  2. I have been learning & experimenting with regular expressions as you suggested & was just curious as to why you use the square brackets inside the curly brackets. I've found that whether I use the square brackets or not, the result is the same. Is it optional or is there a specific reason why they should be used?
  3. My bad, I was trying to make my example simple to get across what I was trying to do & never even considered that the answer could be different if there were decimals involved. Hopefully I'll be a little more thorough next time, but I really appreciate the help from you guys here.
  4. Thank you, That was what I needed & I definitely do need to spend a lot more time learning those expressions. I know it's wrong but I usually learn backwards & try to find a solution to a problem when i run into one instead of learning the basics first.
  5. I appreciate your help but I don't think that solves the problem. I just need to find one specific unknown number in a specific string out of a huge string with multiple numbers. The example of "Joe has (x) large apples" would be the line I'm searching for in like 1,000 lines of code with multiple numbers where (x) is an unknown number. Mac_gyver's solution worked because it took the specific string where the unknown number was inside it & pulled it out. The only problem is that it would only pull out a whole number & the decimal part was lost. Your solution would come up with too many numbers that I would still have to find a way to narrow it down to the specific string that holds the correct number.
  6. Your solution would work if I knew the number in the string but the problem is that don't know the number that will be in the the string that I'm searching for. Basically I'm searching for the number inside a specific string that is inside a larger string.
  7. Well I thought everything was solved but i found that (\d+) only works on whole numbers. I didn't think it would matter if the number had a few decimal points but I was obviously wrong. If there is a decimal like 5.5 or 5.25 then it will only pick up the 5 & not the rest of the number.
  8. Thank you, that's what I was missing.
  9. I've tried preg_match, preg_match_all & preg_quote but I can't find the syntax where I can find an unknown value in the string. All the examples I've found assume there are no unknowns in the string. In my string "Joe has 5 large apples", the number 5 is unknown during the programming call & I only know the string is "Joe has * large apples" .
  10. I want to search for a string like: "Joe has 5 large apples" but don't know the actual number. In other words I want to search for the whatever number is in between "Joe has" & "large apples" I assume there is a way to do that in php but I haven't been able to find it. If so can someone help me with the solution ?
  11. Thanks, I've been reading up on the Apache site but I still haven't figured out how to enable mod_ssl. It explains a lot about it but I don't see the actual steps to add it to the config file.
  12. I'm using Apache on my home server & I ran the same code on my webhost server which I assume is Apache also. My phpinfo() shows Apache under server software environment on my webhost. Neither nginx or FPM show up anywhere in my phpinfo() on either servers. mod_php7 shows on my home server but not on my webhost's server. Home server running php 7.2.34, Web server running php 7.4.30
  13. I printed out the results of $_SERVER & there's nothing about SSL_PROTOCOL. The only thing close is a SERVER_PROTOCOL I also searched the results for "1.3" because I know that is the version of TLS that I'm running & it came up empty. I tried gw1500se's suggestion earlier & it didn't work so I thought he was just joking but maybe not.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.