I am using a GREP search in Sublime Text 3. I want to find all lines that are more than 12 characters, excluding spaces.
Example
Mac and Cheese
Peanut Butter and Jelly Sandwich
In the above example, Mac and Cheese
would not be found, because it's exactly 12 characters excluding spaces.
How would I do this?
I can use the following to find all lines that are more than 12 characters. But I am not sure how to exclude spaces:
(?<=.{13}).+
The pattern (?<=.{13}).+
will assert what is on the left is 13 characters and the dot will also match a space. Then it will match any char except a whitespace 1+ times.
You could match horizontal whitespace chars and repeat 13 or more times matching a non whitespace char for example \S
(or specify what you would allow to match) followed by 0+ horizontal whitespace chars.
^\h*(?:\S\h*){13,}$
^
Start of string\h*
Match 0+ times a horizontal whitespace char(?:
Non capturing group
\S\h*
Match non whitespace char, then 0+ horizontal whitespace chars){13,}
Close group and repeat 13+ times$
End of string