I am using this tool http://regexr.com/3fvg9 I want to mark this (weat)her in regexxr tool.
(weath)er is good. // i want to mark this word
(weather is go)od. // i want to mark this word
Please help me.
I am using this tool http://regexr.com/3fvg9 I want to mark this (weat)her in regexxr tool.
(weath)er is good. // i want to mark this word
(weather is go)od. // i want to mark this word
Please help me.
Since there is no way to check with a regex if a word is "known" or not, I suggest extracting these parts you need first and then use a kind of a spelling dictionary to check if the words are correct. It won't be 100% accurate, but still better than pure regex.
The expression you need to extract the parts of glued words with parentheses is
(?|([a-zA-Z0-9]+)\(([a-zA-Z\s]+)\)|\(([a-zA-Z\s]+)\)([a-zA-Z0-9]+))
See the regex demo at regex101 that supports PHP regex.
The regex matches 2 alternatives inside a branch reset group inside which all capturing groups in different branches are numbered starting with the same ID:
([a-zA-Z0-9]+)\(([a-zA-Z\s]+)\) - Group 1 (([a-zA-Z0-9]+)) matching 1+ alphanumeric chars, then (, and then Group 2 (([a-zA-Z\s]+)) matching 1+ letters and whitespaces and then a ) is matched| - or \(([a-zA-Z\s]+)\)([a-zA-Z0-9]+) - a (, then Group 1 (([a-zA-Z\s]+)) matching 1+ letters and whitespaces, ), and then Group 2 (([a-zA-Z0-9]+)) matching 1+ alphanumeric chars