Answer the question
In order to leave comments, you need to log in
How to find a match so that the group is either before or before the word?
Skill parsing. There is a group of skills - /(python/java|c\+\+|c)/gmi (I'll shorten it, because this is just an example). An extreme case here is /c/ because this letter can simply be in a Latin word. It will be an independent word if either after or before it there are punctuation marks or spaces - /( |,|.|$|^)/gmi. It turns out that this group should be either before or after, but it can also be there and there, but it can never. Is there any good solution for this? I will be glad to any other similar or more effective solutions.
Answer the question
In order to leave comments, you need to log in
You can try something like this:
import re
data = '/(python/java|c\+\+|c)/gmi'
string = r'(\b[\w\\+]+)'
print(re.findall(string, data))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question