in reply to Regex not matching

Why do you beat your wife? Which is to say it does match. Perhaps your actual data has some kind of hidden character between the number and the end of the line (spaces? CR?)

Replies are listed 'Best First'.
Re^2: Regex not matching
by perl_mystery (Beadle) on Jan 29, 2011 at 04:32 UTC

    that's what I also dont get it,am just racking my brain from morning,is there a way I can attach a text doc?

      No.

      If you have od, you could dump your file using

      od -c file

      Or you could use Perl.

      perl -ple's/\\/\\\\/g; s/([^\x21-\x7E])/sprintf(qq{\\x{%X}}, ord($1))/ +eg;' file

      (Switch «'» for «"» for the Windows shell.)

        the reason seems to there is an extra space after the number ,if I remove that extra space it seems to match,not sure why would "an extra space"after the number make a difference

      I dont think I can attach a text doc,but I modified the input to exactly what I have?can you spot a difference which I cant?

        There's definitely a character after the number. A space (unless it's getting corrupted into a space).
Re^2: Regex not matching
by Anonymous Monk on Jan 30, 2011 at 03:45 UTC

     "Why do you beat your wife?"

    I realize this is used figuratively but I think we can all agree there is a better way to express a point than to use a violent image against women.

    A text search shows it's been used before on the site so you're not the first to include it in a post.

    Even without malice or literal meaning behind it the phrase is offensive. Please, to anyone who has used it before or would use it in the future, consider another way to illustrate your point.

      Isn't it rather a reference to traditional quote (see e.g. Loaded_question) rather than the violent image?