in reply to Re: regex help needed
in thread regex help needed
And I’d go with what you did ... an if statement ... purely on “the next-time principle.” The one and only thing you can be sure of is change, so make the code as easy as possible to change next-time. A “clever” regex might be difficult to change – and soon enough a change might well will come along soon for which it is impossible. It’s really only a matter of time. Conditional logic, which does not place the full responsibility upon a single regex but merely obliges it “to get us into the right neighborhood,” will be much more forgiving of change in the long run.