要搜索的字符串示例:
name = 'bob'
person=mary
init= 'tim',
first =sarah,
,name=o'donnel
surny = 'o'doherty',
extend = 'marshall , mathers (111)'
下面的正则表达式搜索是错误的:
[ ]*,?[ ]*(.+)[ ]*=[ ]*'?(.*)'?[ ]*(,|;)*[ ]*
正则表达式替换为2组:\1 \2
以下所需结果:
name bob
person mary
init tim
first sarah
name o'donnel
surny o'doherty
extended marshall , mathers (111)
伪代码基本上是:
optional spaces,one optional comma,optional spaces,any characters (grouped),optional spaces,optional spaces,one optional single quote,any characters (grouped),one optional single quote,optional spaces,one optional comma or semicolon,optional spaces