For my application, I have one string that may contain as item pointers a "space + single character/number + )"
For example:
Some text. 1) blah 2) blah a) yes b) no.
I'd like this to become:
Some text. (1) blah (2) blah (a) yes (b) no.
It seems I understand the use of the back reference $1, but I may not be grasping the functionality of non-capturing groups...
I hoped I could use the latter functionality so in the MAIN CODE I would not get the space between '(' and $1
The first code line below now giving me:
Some text. ( 1) blah ( 2) blah ( a) yes ( b) no.
Local $sOutput = StringRegExpReplace($sInput, '((?:\s).\))', ' ($1' )
As another trial, this doesn't seem to work either:
Local $sOutput = StringRegExpReplace($sInput, '(\s.\))', ' (' & StringRight('$1', 2) )
MAIN CODE:
Test()
Func Test()
Local $sInput = 'Some text. 1) blah 2) blah a) yes b) no.'
; look for 'space + any char + )' and put '(' in front
Local $sOutput = StringRegExpReplace($sInput, '( (?:\s).\) )' , ' ($1' )
Display($sInput, $sOutput)
EndFunc ;==>Test
Func Display($sInput, $sOutput)
; Format the output.
Local $sMsg = StringFormat("Input:\t%s\n\nOutput:\t%s", $sInput, $sOutput)
MsgBox(0, "Results", $sMsg)
EndFunc ;==>Display
Thank you for any pointers