Discussion:
[Cocci] [PATCH] demos: python_regexp: Fix regex matching
Himanshu Jha
2018-01-15 12:36:45 UTC
Permalink
Fix regex matching by using correct python syntax by passing the
compiled regex object to the argument of search function for effective
searching.

Signed-off-by: Himanshu Jha <***@gmail.com>
---
demos/python_regexp.cocci | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/demos/python_regexp.cocci b/demos/python_regexp.cocci
index ce43367..ffb4bd1 100644
--- a/demos/python_regexp.cocci
+++ b/demos/python_regexp.cocci
@@ -16,7 +16,7 @@ id << r_init.id;
@@

print "COCCI: Analyzing %s" % id
-if m.search(id.ident) != None:
+if m.search(id) != None:
print "COCCI: %s matchs '_new$'" % id
else:
print "COCCI: %s discarded" % id
--
2.7.4
Julia Lawall
2018-01-15 20:29:14 UTC
Permalink
Post by Himanshu Jha
Fix regex matching by using correct python syntax by passing the
compiled regex object to the argument of search function for effective
searching.
Applied, thanks.

julia
Post by Himanshu Jha
---
demos/python_regexp.cocci | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/demos/python_regexp.cocci b/demos/python_regexp.cocci
index ce43367..ffb4bd1 100644
--- a/demos/python_regexp.cocci
+++ b/demos/python_regexp.cocci
@@ -16,7 +16,7 @@ id << r_init.id;
@@
print "COCCI: Analyzing %s" % id
print "COCCI: %s matchs '_new$'" % id
print "COCCI: %s discarded" % id
--
2.7.4
Loading...