I m 定期发言
(\w+[ ]*|-\w+[ ]*)(!=|<=|>=|=|<|>| not in | in | not like | like )(.*)
这三节按 com子顺序排列。
当我试图与像这样的东西相匹配时。
product(getProduct_abc) in (Xyz)
它不配对。
但是,当我试图匹配的时候。
100=product(getProduct_abc) in (Xyz)
它完全吻合。
reg?
I m 定期发言
(\w+[ ]*|-\w+[ ]*)(!=|<=|>=|=|<|>| not in | in | not like | like )(.*)
这三节按 com子顺序排列。
当我试图与像这样的东西相匹配时。
product(getProduct_abc) in (Xyz)
它不配对。
但是,当我试图匹配的时候。
100=product(getProduct_abc) in (Xyz)
它完全吻合。
reg?
任何东西都不会错,而且经常表达。 这只是不符合具体的指示。
你们需要找到一个很好的参考资料,介绍定期表达和学习基本内容。 http://www.ual-expressions.info/“rel=“nofollow”>。 这或许或不可能很好地提及你作为开端人。 (我正在利用他的雷克迪工具测试你的定期表达。)
这里的表述大致如下:
(Xyz)的铺设产品(植被-abc)不匹配,因为在<条码>中条码>的操作者,其特性不止是“密码”。 母体不被视为“密码”性质,因此造成相应的失败。
第2条(Xyz)中的100=产品(目标-abc)对应,因为它使用同等产品(=)作为第二组的配对操作者,100是所有“词”特性的体,在“任何特性”部分之后,所有东西都与“任何特性”部分相匹配,因此相匹配。 请注意,视如何处理警戒线,某些语言甚至可能达不到这种距离,如果它处于护法的末尾。
如果第一部指示为,则需要与您的商业用户核对。 也许他们也是以定期表达方式开始的,并给你一个没有工作的人。
这是我看到的:
100=product(getProduct_abc) in (Xyz)
Group1 match = 100
Group2 match = =
Group3 match = product(getProduct_abc) in (Xyz)
product(getProduct_abc) in (Xyz)
^
Fails here on Group1 match because parenthesis are not included in this group
You can fix the situation by forcing the last occurance of group 1,2,3 match in the string.
Fixing/Rewriting the equavalent Group1 match and separating the groups, they can be re-combined to force the last match possible.
rxP1 = (?:-?[w()]+ *) ;
rxP2 = (?:!=|<=|>=|=|<|>| not in | in | not like | like ) ;
rxP3 = (?:.*?) ;
rxAll = /(?:$rxP1$rxP2$rxP3)*($rxP1)($rxP2)($rxP3)$/;
In Perl:
use strict;
use warnings;
my @samples = (
product(getProduct_abc) in (Xyz1) ,
100=product(getProduct_abc) in (Xyz2) ,
100 like = != not like >product(getProduct_abc) in (Xyz3) ,
);
my $rxP1 = (?:-?[w()]+ *) ;
my $rxP2 = (?:!=|<=|>=|=|<|>| not in | in | not like | like ) ;
my $rxP3 = (?:.*?) ;
for (@samples)
{
if ( /(?:$rxP1$rxP2$rxP3)*($rxP1)($rxP2)($rxP3)$/ ) {
print "
1 = $1
";
print "2 = $2
";
print "3 = $3
";
}
}
产出:
1 = product(getProduct_abc)
2 = in
3 = (Xyz1)
1 = product(getProduct_abc)
2 = in
3 = (Xyz2)
1 = product(getProduct_abc)
2 = in
3 = (Xyz3)
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" ...