regex - How to make the regexp ignore a new line in python? -


i use regex that

return(\s+([^"\n;]+))?; 

in order match return statement in obj-c,but when use through python this:

re.sub(r'return(\s+([^"\n;]+))?;',r'{\g<0>}',str(content)) 

i find match statement

//please {return [self funca];} 

and make code error.how can deal ?

i think issue regex has \s matches whitespace.

you might want match literal spaces or tabs [ \t]:

r'return([ \t]+([^"\n;]+))?;' 

(demo) or - better:

r'return[ \t]+[^"\n;]*;' 

see the regex demo


Comments

Popular posts from this blog

PHP while loop dynamic rowspan -

timer - Java TimerTask cancel -

android - How to read a column value in parse.com without accessing an object or a pointer -