简体   繁体   English

记事本++中的正则表达式

[英]Regular expressions in notepad++

I want to match the following expression in notepad ++, how can I do that ? 我想在记事本++中匹配以下表达式,该怎么做? <table align="center" cellpadding="4" cellspacing="3" border="1" bgcolor="#B1A0C7">

I want to match from the beginning of <table and then all in between characters and stop at the first > 我希望从<table的开头匹配,然后在字符之间进行匹配,并在第一个>处停止

i did the following but it doesn't work for me (<table).*>$ it keep getting the last > in the line ... I want the first > 我做了以下但是它对我不起作用(<table).*>$它继续得到最后的>在行...我想要第一个>

Try this: 尝试这个:

<table[^>]*?>

explain: 说明:

*? Matches the previous element zero or more times, but as few times as possible. 匹配前一个元素零次或多次,但尽可能少。

[^character_group] Negation: Matches any single character that is not in character_group . [^character_group]否定:匹配不在character_group任何单个character_group

Try this: 尝试这个:

<table[^>]*>

Use [^>] to match any character but > , making it select only that first tag. 使用[^>]匹配除>任何字符,使其仅选择第一个标记。 This will include newline characters, so this regex will work for: 这将包括换行符,所以这个正则表达式为工作:

<table align="center"
       cellpadding="4"
       cellspacing="3"
       border="1"
       bgcolor="#B1A0C7">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM