|
Post by ManfredU on Mar 21, 2018 9:52:41 GMT -5
I didn't find in the documentation how to use reg ex capturing groups to reinsert the text matched by any of those capturing groups in the replacement text.
Change command:
c r'(DISPLAY )XXX-(.*)' '\1 \2' all
Source:
DISPLAY XXX-STREET. DISPLAY XXX-TOWN.
Result:
DISPLAY STREET. DISPLAY TOWN.
Thanks Manfred
|
|
|
Post by George on Mar 21, 2018 10:43:43 GMT -5
Hi Manfred. I'm afraid the Regex support is one-sided - search only. Since I'm a Regex 'novice' I can't really decipher what your attempting.
Can you describe it for me, there might be another way (mapping strings?).
George
|
|
|
Post by ManfredU on Mar 21, 2018 11:10:33 GMT -5
Regular expressions allow not not just match text but also to extract information for further processing. This is done by defining groups of characters and capturing them using the special parentheses ( and ) metacharacters. Any subpattern inside a pair of parentheses will be captured as a group which then can be used as substitution in the output string.
Ok, so this is not implemented.
Yes, in my case it will work with mapping strings, but using reg ex groups are more flexible with variable length matches I believe.
|
|
|
Post by George on Mar 21, 2018 11:31:30 GMT -5
Manfred: I agree that allowing full RegEx support in the change function would be desirable, but fitting this into the SPF style support including the internal requirements for RFIND and RCHANGE logic (which is also used by CHANGE ALL) is, I'm afraid, just beyond my skill set. (Or at least beyond what I'd consider to tackle right now.)
George
|
|
|
Post by ManfredU on Mar 21, 2018 11:50:57 GMT -5
Ok, thanks. I will come back here when I have more questions.
|
|
|
Post by George on Mar 22, 2018 11:28:33 GMT -5
Robert: Thanks for hopping in. You've certainly got the Mapping string knowledge that I don't.
George
|
|