I’m trying to write regular expression for the next pharse "AE/ME 5101" or "AWE/ME 5101" or or "any text or no text AWE/MERL 5101 any text or no text"
I need to catch "AWE/MERL 5101" or "AE/ME 5101" or "AWE/ME 5101" in the string or the string can have only this pharse. Anyway i need extract it. I’m trying to use /[A-Z]{1-4}/[A-Z]{1-4}/ but it doesn’t work
Any help
2
Answers
I suggest you use the possible variations of your string inside a bracket, and to avoid collisions use another character – suggested here
~
– as the pattern delimiter:Check:
Result:
If you need the actual text that matched, this is available in
$matches[0]