+ Reply to Thread
Results 1 to 3 of 3

Thread: Regular Expressions Lowercase

  1. #1
    garrensilverwing's Avatar
    garrensilverwing is offline x10 Sophmore garrensilverwing is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    148

    Regular Expressions Lowercase

    PHP Code:
    preg_match_all('/\[(\w+) "([^"]+)"\]/'$game$matchesPREG_SET_ORDER); 
    hey guys, I have this regular expression that is supposed to grab information from a large string. unfortunately it only works if i strtolwr the entire string first. i want it to grab information as is, without having to convert everything to lower case. this is causing me a headache because i am not very good with regular expressions. if you need more information let me know.

  2. #2
    lemon-tree's Avatar
    lemon-tree is offline x10 Minion lemon-tree has a spectacular aura about
    Join Date
    Nov 2007
    Posts
    1,420

    Re: Regular Expressions Lowercase

    Add the i tag, this makes it case insensitive, although it does seem odd that it isn't accepting it currently as you don't appear to have anything case sensitive in there. Also, what are you trying to match, as you seem to have an odd layout for the ranges.
    PHP Code:
    preg_match_all('/\[(\w+) "([^"]+)"\]/i'$game$matchesPREG_SET_ORDER); 
    Last edited by lemon-tree; 10-09-2010 at 07:12 PM.

  3. #3
    garrensilverwing's Avatar
    garrensilverwing is offline x10 Sophmore garrensilverwing is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    148

    Re: Regular Expressions Lowercase

    I'll try adding the /i and see if that helps

    [Event "September 2010 DCC Tuesdays"]
    [Site "?"]
    [Date "2010.09.07"]
    [Round "1"]
    [White "Patin, Andre"]
    [Black "Willis, Mark"]
    [Result "1/2-1/2"]
    [ECO "B03"]
    [WhiteElo "1447"]
    [BlackElo "2040"]
    [PlyCount "60"]
    [SourceDate "2010.01.06"]
    [WhiteTeam "12777488"]
    [BlackTeam "12199280"]

    1. e4 Nf6 2. e5 Nd5 3. c4 Nb6 4. d4 d6 5. f4 dxe5 6. fxe5 c5 7. d5 e6 8. Nc3
    exd5 9. cxd5 c4 10. Nf3 Bb4 11. Bxc4 O-O 12. Bb3 Na6 13. Bg5 f6 14. d6+ Kh8 15.
    Bf4 fxe5 16. Bxe5 Bg4 17. Bxg7+ Kxg7 18. Qd4+ Qf6 19. Qxg4+ Kh8 20. O-O Bxd6
    21. Ne4 Qf4 22. Qxf4 Bxf4 23. Neg5 Nc5 24. Bc2 h6 25. Nh3 Be3+ 26. Kh1 Nc4 27.
    Nh4 Rxf1+ 28. Rxf1 Nxb2 29. Rf7 Kg8 30. Rh7 b5 {Game drawn} 1/2-1/2
    that is an example of what i am trying to match. i want to grab everything that is inside the brackets, maybe that will clear it up a little?

+ Reply to Thread

Similar Threads

  1. How to change categories to lowercase in wordpress
    By ataarticles in forum Scripts & 3rd Party Apps
    Replies: 7
    Last Post: 07-11-2010, 12:45 PM
  2. Replies: 3
    Last Post: 04-04-2010, 05:42 PM
  3. Htaccess - regular expressions
    By lair360 in forum Tutorials
    Replies: 1
    Last Post: 05-04-2009, 12:48 AM
  4. Uppercase links to lowercase
    By driveflexfuel in forum Programming Help
    Replies: 6
    Last Post: 12-19-2008, 04:55 PM
  5. .htaccess redirect with regular expressions
    By Scoochi2 in forum Programming Help
    Replies: 0
    Last Post: 08-25-2008, 07:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers