Reputation: 1401
I got this string:
use \blahblah\file
I need to get use \
using a regex. For now I got, \suse
but I can't figure out how to get the first backslash. Any thoughts?
Thanks!
Upvotes: 0
Views: 177
Reputation: 11116
you need to get use \
, then use use \
. remember we need to escape characters with special meaning in regular expressions
Upvotes: 1
Reputation: 174874
You could try the below regex to get the chars upto the first \
(including \ )
^[^\\]*\\
Upvotes: 2