I should be able to get a matching combination from the string. Example:
$ mystring = "This is my text 00123 blah blah"; $ Code = Warm Gacks ($ mystring, "text" [0-9]); Return "You are a magician - your code is". $ Code; Return :
You are a wizard - your code text is 00123 Again, let me separate it Text in a different variable than the integer.
as another option on the capture name:
\ B (? & Lt; text & gt; \ w +?) (? Number & gt; \ d +) \ b demo:
$ Str = "This is my text 00123 blah blah"; $ _ = Null; Preg_match ("/ \ b (& lt;? Text & gt; \ w +) (& lt; number; gt; \ d +) \ b /", $ str, $ _); Echo "text: {$ _ [text]} - number: {$ _ [number]}"; Oh, reversed the argument; P
Comments
Post a Comment