正则表达式
((\d{4}|\d{4}-)?\d{7})|((\d{3}|\d{3}-)?\d{8})|(1(?:\s*)[35](?:\s*)[0123456789](?:\s*)(\d(?:\s*)){8})[qQ](.+?)(\d(?:\s*)){7}
请问这个是什么意思? --------------------编程问答-------------------- ((\d{4} ¦\d{4}-)?\d{7}) ¦((\d{3} ¦\d{3}-)?\d{8}) ¦(1(?:\s*)[35](?:\s*)[0123456789](?:\s*)(\d(?:\s*)){8})
[qQ](.+?)(\d(?:\s*)){7}
Match the regular expression below and capture its match into backreference number 1 «((\d{4} ¦\d{4}-)?\d{7})»
Match the regular expression below and capture its match into backreference number 2 «(\d{4} ¦\d{4}-)?»
Between zero and one times, as many times as possible, giving back as needed (greedy) «?»
Match a single digit 0..9 «\d{4}»
Exactly 4 times «{4}»
Match the characters “ |” literally « ¦»
Match a single digit 0..9 «\d{4}»
Exactly 4 times «{4}»
Match the character “-” literally «-»
Match a single digit 0..9 «\d{7}»
Exactly 7 times «{7}»
Match the characters “ |” literally « ¦»
Match the regular expression below and capture its match into backreference number 3 «((\d{3} ¦\d{3}-)?\d{8})»
Match the regular expression below and capture its match into backreference number 4 «(\d{3} ¦\d{3}-)?»
Between zero and one times, as many times as possible, giving back as needed (greedy) «?»
Match a single digit 0..9 «\d{3}»
Exactly 3 times «{3}»
Match the characters “ |” literally « ¦»
Match a single digit 0..9 «\d{3}»
Exactly 3 times «{3}»
Match the character “-” literally «-»
Match a single digit 0..9 «\d{8}»
Exactly 8 times «{8}»
Match the characters “ |” literally « ¦»
Match the regular expression below and capture its match into backreference number 5 «(1(?:\s*)[35](?:\s*)[0123456789](?:\s*)(\d(?:\s*)){8})»
Match the character “1” literally «1»
Match the regular expression below «(?:\s*)»
Match a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.) «\s*»
Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
Match a single character present in the list “35” «[35]»
Match the regular expression below «(?:\s*)»
Match a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.) «\s*»
Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
Match a single character present in the list “0123456789” «[0123456789]»
Match the regular expression below «(?:\s*)»
Match a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.) «\s*»
Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
Match the regular expression below and capture its match into backreference number 6 «(\d(?:\s*)){8}»
Exactly 8 times «{8}»
Note: You repeated the capturing group itself. The group will capture only the last iteration. Put a capturing group around the repeated group to capture all iterations. «{8}»
Match a single digit 0..9 «\d»
Match the regular expression below «(?:\s*)»
Match a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.) «\s*»
Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
Match the characters “” literally «
»
Match a single character present in the list “qQ” «[qQ]»
Match the regular expression below and capture its match into backreference number 7 «(.+?)»
Match any single character that is not a line break character «.+?»
Between one and unlimited times, as few times as possible, expanding as needed (lazy) «+?»
Match the regular expression below and capture its match into backreference number 8 «(\d(?:\s*)){7}»
Exactly 7 times «{7}»
Note: You repeated the capturing group itself. The group will capture only the last iteration. Put a capturing group around the repeated group to capture all iterations. «{7}»
Match a single digit 0..9 «\d»
Match the regular expression below «(?:\s*)»
Match a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.) «\s*»
Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
--------------------编程问答-------------------- 楼上的正解。。。
(
(\d{4}¦\d{4}-)?\d{7}//7位电话号码05551111111或者0555-1111111
)¦(
(\d{3}¦\d{3}-)?\d{8}//匹配手机号码 13333333333或者 133-33333333
) ¦(
1(?:\s*)[35](?:\s*)[0123456789](?:\s*)(\d(?:\s*)){8})[qQ](.+?)(\d(?:\s*)){7}
//1 3 1 8 8 8 8 8 8 8 8 q 4 4 4 4 4 4 4
最后一个不知道匹配啥玩意。。。。。貌似没什么意义吗。。。。
补充:.NET技术 , C#