正規表現のいろは

657 views

Published on

正規表現のはじめの一歩。
入門
いろは
正規表現

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
657
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
9
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • 正規表現のいろは

    1. 1. 2012/01/16
    2. 2. [abc]A single character: a, b or c[^abc]Any single character but a, b, or c[a-z]Any single character in the range a-z[a-zA-Z]Any single character in the range a-z or A-Z
    3. 3. : > >> >
    4. 4. [ - ][ - ]
    5. 5. [ - ]
    6. 6. : .: Any single characters: Any whitespace characterS: Any non-whitespace characterd: Any digitD: Any non-digitw: Any word character (letter, number, underscore)W: Any non-word charactern: New line ( )t: Tab ( )r: Carriage return
    7. 7. :^Start of line$End of lineAStart of stringzEnd of stringbAny word boundary character
    8. 8. :(...): Capture everything enclosed ( )(a|b): a or ba?: Zero or one of aa*: Zero or more of a (0 ) ( )a*?: Zero or more of a (0 ) ( )a+: One or more of a (0 ) ( )a+?: One or more of a (0 ) ( )a{3}: Exactly 3 of aa{3,}: 3 or more of aa{3,6}: Between 3 and 6 of a
    9. 9. /
    10. 10. a.*c ( )abc abc abc abca.*c a c
    11. 11. a.*?c ( )abc abc abc abca.*?cabc a cabc
    12. 12. 1[0-9]{3}-[0-9]{4}-[0-9]{4}d{3}-d{4}-d{4}
    13. 13. ^ => ^ { } => { }$ => $ . => . => + => +- => - * => *[ ] => [ ] ? => ?( ) => ( ) | => |
    14. 14. 2^0(8|9)0-[0-9]{4}-[0-9]{4}$^(0)(?:8|9)1-d{4}-d{4}$↑
    15. 15. //
    16. 16. /(?=aaa)(?!aaa)(?<=aaa)(?<!aaa)
    17. 17. /(?<= ) (?= )(?= ):(?<= ): (* )
    18. 18. /
    19. 19. (?= )
    20. 20. (?! )
    21. 21. (?<= )
    22. 22. (?<! )
    23. 23. / ( )=> /=>1, 2, 3 ...($1, $2, $3 ... )( )
    24. 24. 2
    25. 25. (0) 0 (Match captures )(?:8|9)(?:) 1 0 (0)(?:8|9)1 090 080
    26. 26. Webhttp://www4.ocn.ne.jp/~kaerume/k2e/regex_top.html#mnu_tophttp://www.kt.rim.or.jp/~kbk/regex/regex.html#NEGATIVELOOKAHEADhttp://blog.96q.org/2010/02/24/collection-of-regular-expression-problems/
    27. 27. 3, 5, 7 ( ) _() _0103> (Monday)=>0103> (0103_Monday_ )

    ×