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!

Sociable:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Furl
  • NewsVine
  • Reddit
  • YahooMyWeb

3 Responses to “How’s that for a RegExp?

  • Mark
    February 11th, 2005 18:54
    1

    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.

  • perlworld
    February 11th, 2005 20:47
    2

    Ooh, I love regex’s, my favourite toy.

    Post what your using this for, I love good game of Perl Golf

  • Mark Moo
    February 14th, 2005 23:53
    3

    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…

Leave a Reply