I have a line that can change, but will always contain x={stuffNeeded} .
For example: n=1,x={y,z,w},erore={3,4,5} or x={y,z,w} or erore={3,4,5},x={y,z,w} , etc.
I have damn time to figure out how to get y,z,w . The closest I found to find the answer was based on Yathart's answer to this other message. Regular expression to return all characters between two special characters .
In my search, I still came across something that almost worked. Testing was done here http://rubular.com/r/bgixv2J6yF and in python.
This has been tested in python using:
i='n=1,x={y,z,w},erore={3,4,5}' j='n=1,x={y,z,w}' print re.search('x={(.*)}',i).group(1) print re.search('x={(.*)}',j).group(1) print re.search('x={(.*)}.',i).group(1) print re.search('x={(.*)}.',j).group(1)
Result for four different images:
'y,z,w' 'y,z,w},erore={3,4,5' AttributeError: 'NoneType' object has no attribute 'group' 'y,z,w'
Required result: 'y,z,w' for all cases, and then if x={*} was not really found, I would put an error.
Thanks in advance.