SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Question Can I have a list the preg_match characters?

    Hi everyone. Can someone give me a list of the assertations in php's preg_match function?

    I mean like '\bsome\b' would search for words with ONLY 'some' in it, not 'someone' or 'something'.

    Can I have a list please? PHP.net isn't very useful on these.
    Thanks.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    another bit i have seen (although i can't figure it out, or how it works) is "(?:\s|(?:<.*?>))*", which filters out tags.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,424
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    the preg section of the php manual has two pages dedicated to the token used in regular expressions. have you look at those two pages?

  5. #5
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    oh thanks. I was just looking at preg_match, and it didn't explain what the characters where. Thanks for your help
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  6. #6
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Its not very helpful... It assumes you know the perl syntax. Theres not much at all on the web to do with 'metacharacters' (found their name!), according to google. They are completely different anyway, like it says \b is equal to a backspace when according to another article \b means a break...? :S
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  7. #7
    SitePoint Zealot
    Join Date
    Jul 2006
    Location
    Dundee, Scotland
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    \b is a word boundary which can be a new line or a space etc.

    http://www.phpbuilder.com/columns/dario19990616.php3 is a tutorial on regular expressions but they of course do not cover everything (very few tutorials will do).

    A book I find handy for reference purposes is http://www.amazon.co.uk/Regular-Expr...731390-1070002 As well as giving a pretty comprehensive list of metacharacters it shows a table of which will work with php (as well as other languages)

  8. #8
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arkinstall View Post
    It assumes you know the perl syntax.
    you need to read farther down the page. that's just the first section.

  9. #9
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i found this one very nice. pretty long too

    http://regularexpressions.info/tutorial.html


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •