需要regEx这个。 [英] Need regEx for this.
本文介绍了需要regEx这个。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
我有一份文件,其中我必须在<之间找到Foto字样和>标签。我用这个正则表达式
hi
i have a document in which i have to find word "Foto" in between the "<" and ">" tags. i used this regex
"<(?:\w*)?Foto(?:\w*)?>"
如果字符串只有字母,这个工作正常标签之间的单词,但是有任何特殊字符然后它找不到。就像这样..
this is working fine if there is a string with only alphabetic words in between the tags, but is there is any speacial character then it fails to find.like this..
<hello world Foto:abc> ..... Find ok
<hello "world Foto:abc>.....Find fail
推荐答案
你好Choudhary,
\w 正则表达式:< b>任何单词字符(字母,数字,下划线)
您可以使用 。 (点)表示:任何单个字符
祝你好运,
Edo
Hello Choudhary,
\w in regex means: any word character (letter, number, underscore)
you may use . (dot) that means: any single character
Good luck,
Edo
Choudhary有一个很好的答案。为了帮助您进一步查看其中的一些网站。一个非常有用的网站是 regexlib [ ^ ];它们有一个大型的正则表达式库。它们还有一个正则表达式测试仪 [ ^ ]。此外,还有一个非常有用的RegEx工具此处 [ ^ ]
Choudhary has a good answer. To help you further check out some of these sites. A very helpful site is regexlib[^]; they have a large library of Regular Expressions. They also have a RegEx tester[^]. Also a very useful RegEx tool is available here[^]
这篇关于需要regEx这个。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文