#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Match any string


    Hi,

    I am trying to match any string that is inputted..( basically matches anything)

    I am using .* for this. But it does not match it.

    I tried using: \.\* but this does not match either and therefore figured my pattern is wrong.

    Can you explain what is the correct exp for this case?
  2. #2
  3. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2007
    Posts
    1,940
    Rep Power
    3117
    .* Should match anything, maybe there is a problem in your testing?
    \.\* Should only match the String .*
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    Does your language's match function require the entire string to match and are you matching input containing a newline? If so your problem might be that the dot doesn't match newlines by default. Look for the 's' or DOT_ALL option in your regex documentation.

    Comments on this post

    • ManiacDan agrees
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);
  6. #4
  7. kill 9, $$;
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2001
    Location
    Shanghai, An tSín
    Posts
    6,897
    Rep Power
    3886
    What programming language is this regexp being run in?

IMN logo majestic logo threadwatch logo seochat tools logo