SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Regex

  1. #1
    SitePoint Zealot
    Join Date
    Aug 2006
    Location
    Newcastle, England
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Regex

    Hi,

    I'm using the following regex to extract some information from a spreadsheet

    Code PHP:
    $finishPattern = '#(silk|gloss|standard|matt laminated|gloss laminated|wholesale|recycled|praxis|conqueror|pharoah)#i';
    preg_match($finishPattern, $material, $finish);

    It runs through and pulls out a type of finish.

    The problem is I would like, where instances of 'gloss laminated' appear, to pull out 'gloss laminated' rather than obtaining just 'gloss'.

    I hope this makes sense.

    Thank you in advance to any enlightenment

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Put the more specific strings on the left.

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2006
    Location
    Newcastle, England
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    genius!

    what was i thinking!?!

    thank you for your time


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
  •