关于在大案文中找到名字,我有以下格文:
([A-Z][a-z]*)[s-]([A-Z][a-z]*)
对于诸如“Jack Oneill”或“John Guidetti”等普通名称,该作品是罚款的。 但我想找到一些可能性,但无法找到。 和:
Chandler Murial Bing
Gandalf the Gray
Pieter van den Woude
在我对定期表达方式的了解有限的情况下,我似乎无法享有这一权利。 任何人都可以帮助我(请为此提供良好的网站/手册):
关于在大案文中找到名字,我有以下格文:
([A-Z][a-z]*)[s-]([A-Z][a-z]*)
对于诸如“Jack Oneill”或“John Guidetti”等普通名称,该作品是罚款的。 但我想找到一些可能性,但无法找到。 和:
Chandler Murial Bing
Gandalf the Gray
Pieter van den Woude
在我对定期表达方式的了解有限的情况下,我似乎无法享有这一权利。 任何人都可以帮助我(请为此提供良好的网站/手册):
处理经常表达问题的最佳方式是描述你所期望的匹配(通常称为grammar/em>)。
例如,从你的问题来看,我可以说是:
.
(an initial).如果这提供了与预期结果相当的接近(而且为了明确,就姓名而言,你会有这么多的改动,否则就会有虚假的正面或错误的负面之处),那么你就开始构造以下表述:
[A-Z]([a-z]+|.)
[a-z][a-z-]+
Result:
[A-Z]([a-z]+|.)(?:s+[A-Z]([a-z]+|.))*(?:s+[a-z][a-z-]+){0,2}s+[A-Z]([a-z]+|.)
Match(果敢):
Hello my name is Chandler Muriel Bing. I have a friend who is named Pieter van den Woude and he has another friend, A. A. Milne. Gandalf the Gray joins us. Together, we make up the Friends Cast and Crew.
问题:
Recently I discovered two amazing regular expression features: ?: and ?!. I was curious of other neat regex features. So maybe you would like to share some tricky regular expressions.
I need to remove image tags from text, so both versions of the tag: <img src="" ... ></img> <img src="" ... />
How do I, using preg_replace, replace more than one underscore with just one underscore?
I was trying to write a regexp to replace all occurrences of with unless the is already preceeded immediately by a . I m doing this in Ruby 1.8.6 which doesn t support look behind in ...
Specifically, I have an array of strings called val, and want to replace all instances of "%{n}%" in the input with val[n]. More generally, I want the replace value to be a function of the match ...
I have the following log entry that I am processing in PowerShell I m trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I m ...
I m building a lexical analysis engine in c#. For the most part it is done and works quite well. One of the features of my lexer is that it allows any user to input their own regular expressions. This ...
I need a regex for four-digit numbers separated by comma ("default" can also be a value). Examples: 6755 3452,8767,9865,8766,3454 7678,9876 1234,9867,6876,9865 default Note: "default" ...