php - Regular expression to match hyphenated words -
How can I remove the hyphenated wire from this string line?
ADW-CFS-WE CI SLAF NO SLANAME CI MAX OUTAGE SERVICE
I want to remove "ADW-CFS-WE" from it but have been a lot unsuccessful over the past few hours. I was selected about all the strings selected from this simple regEx "(. *)"
You may use:
preg_match ("/ \ w + (- \ w +) + /", ...) Code> \ w + will match any alphanumeric character (= one word) in any number. And the second group has any additional hiffin numbers with () letters. The trick with regular expressions is often uniqueness. . * will often be too much to match.
Comments
Post a Comment