You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following has been tested with 32 and 64bit versions of PS 1.5.4 and PS 3.0.6
importretest='#1 #2 #3 #4 #5'matches_list= []
defmatch_found(match):
matches_list.append(match)
print(','.join(m.group() forminmatches_list))
defmain():
globalmatches_listmatches_list=list()
print('python regex')
forminre.finditer('#\d', test):
match_found(m)
matches_list=list()
print('regex search with normal callback function')
editor.research('#\d', match_found)
matches_list=list()
print('regex search with lambda function and stored group result')
editor.research('#\d', lambdam: matches_list.append(m.group()))
print(','.join(mforminmatches_list))
# # CRASH# print('regex search with lambda function and stored match object')# matches_list = list()# editor.research('#\d', lambda m: matches_list.append(m))# print(','.join(m.group() for m in matches_list))main()
The ouput is always
python regex
#1
#1,#2
#1,#2,#3
#1,#2,#3,#4
#1,#2,#3,#4,#5
regex search with normal callback function
#1
#2,#2
#3,#3,#3
#4,#4,#4,#4
#5,#5,#5,#5,#5
regex search with lambda function and stored group result
#1,#2,#3,#4,#5
The interesting part is the regex search with normal callback function.
As we can see, the match objects are corrupted, and I assume that this is also the reason for the crash of the last, commented test.
Once the editor.research is finished, there are no valid match objects.
Unfortunately, this is all I can contribute with my lack of C++ knowledge.
Using either 32-bit or 64-bit PythonScript v1.5.4, I get a crash when running the following code:
If I change
main()
to be:Then the code runs as intended and produces proper output:
so I think it has something to do with the "lambda"ing??
Anyway, the crash is a hard one, and gives me this box:
The text was updated successfully, but these errors were encountered: