are searching for strings with varying amounts of spaces / data in between, possible?
-
Hi guys, my first time posting here… Let’s say a paragraph reads as follows (in quotes):
“The sky is blue.
The sky is very blue.
A red sky can even possibly turn 336699 blue today.”Using notepad++, is it possible for me to do some type of search that will find me all instances of the word “sky” following by any number of characters (numbers and/or letters), followed by the word “blue”? There are 3 total instances of this situation in the paragraph above, but notice that the data in between “sky” and “blue” on each line / instance is not consistent; it could be varying lengths of data, it could be numbers, it could be letters, different amounts of spaces, etc. I realize that doing a find for “sky” asterick “blue” won’t do the job.
Is what I’m asking possible? Also, what’s the name for this type of search?
Thanks,
Fred -
Yes, very possible with the use of Regular expression search as follows:
Find what zone:
(?-is)sky.+blue
Search mode: Regular expressionYou should be able to deduce what the
.+does.
The(?-is)at the beginning indicates 2 things:- case of
skyandbluemust match exactly (the-ipart) - the
.will NOT match end-of-line characters (thespart, but note that the-from earlier effectively makes this-s)
Probably this is confusing, so a better explanation is that the
istands for (case) insensitive, so-imeans NOT case insensitive, or rather case sensitive (meaning case must be exact for a match to occur)A better explanation for the
spart:(?s)means that any.characters occurring will match one character of any type (including end-of-line characters).(?-s)means that any.characters occurring will match one character of any type EXCEPT it won’t match the end of line characters (carriage return, line feed). - case of
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login