I am trying to match all words with single or multiple spaces. my expression
(\w+\s*)* is not working
edit 1:
Let say i have a sentence in this form
[[do "hi i am bob"]]
[[do "hi i am Bob"]]
now I have to replace this with
cool("hi i am bob") or
cool("hi i am Bob")
I do not care about replacing multiple spaces with single .
I can achieve this for a single word like
\[\[do\"(\w+)\"\]\] and replacing regex cool\(\"$1\") but this does not look like an effective solution and does not match multiple words ….
I apologies for incomplete question
any help will be aprecciated
Find this Regular Expression:
And do the following replacement:
The only special thing that’s being done here is using character classes to our advantage with
Matches one or more word or space characters (a-z, A-Z, 0-9, _, and whitespace). That’;; eat up your internal stuff no problem.
Spits out
Though – if you want to add punctuation (which you probably will), you should do it like this:
Which will match any character that’s not a double quote, preserving your substring. There are more complicated ones to allow you to deal with escaped quotation marks, but I think that’s outside the scope of this question.