How to make a proper Regex -
i have think simple question on making regex. here's string:
confl 2284341 /folder/path/file.xlsx i want make sure line has "confl" in it, , want capture full path. came is:
.*confl .*(\/.+) but captures file name, not full path (i can live not getting initial forward slash). seemed straight forward, is regex, so...
anyone me out?
thanks!
change
.*confl .*(\/.+) to
.*confl .*?(/.+) this prevent middle .* being "greedy" , capturing last slash. instead, question-mark makes "possessive", stops before first slash, goal.
unless there i'm misunderstanding, don't need escape slash before up-right slash, i've removed.
Comments
Post a Comment