How’s that for a RegExp?
This may not be exactly what I need, but it does seem to do work with some basic tests:
/<\s*input(?:.*?)(name|value)\s*=\s*(?:'|")(.*?)(?:'|") (?:.*?)(name|value)\s*=\s*(?:'|")(.*?)(?:'|")(?:.*?)>/is
Of course, you don’t know what I need it to do (and you probably won’t care), but I thought I’d share it with you all, dear reader… Aren’t you lucky!










February 11th, 2005 18:54
Not sure why there is a space before the first backslash-s — it shouldn’t be there, but wordpress seems to be dropping it in. Strange.
February 11th, 2005 20:47
Ooh, I love regex’s, my favourite toy.
Post what your using this for, I love good game of Perl Golf
February 14th, 2005 23:53
Bah, doesn’t quite work. I’m trying to pull form input tags out of bad HTML. And the tags are rather messy too, some without quotes, some with apostrophes, and lots with line breaks and so on. Quiet messy. May need to turn to PEAR to help me out, but would like to come up with a regexp fix for it…