On 5/25/2010 5:46 AM, Caius Durling wrote: > > But what happens when you have a string that contains *all* the > above characters, and indeed any valid regex delimiting character in > PHP? Then the above function fails and you can't build a valid > regex.
Then it returns null and the caller has to handle it however it considers appropriate -- throwing an error, or re-invoking with an explicit set of delimiters, or whatever -- such as doing the explicit escaping thing you mention. (And remembering to de-escape afterward.) > You can escape the string as you wrap the delimiters around it, > which will work no matter what the string contains - it can contain > all the valid delimiters and still work. The main problem there is that doing the escaping (and UNescaping afterward) becomes the caller's problem. Choose the right delimiter and you don't need to worry about that. regexdelim() just tries to do that. -- Ken Coar OSS developer, opinionist, author, and sanagendamgagwedweinini -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/habari-dev
