Search characters if exist in any order with no spaces?
-
Hello!
I want to find all instances of certain characters together even if jumbled order with a fixed letter or string of letters at end
example
search for <+., or +<,. and so on, find all instances if contain
with the letter or string becomes
<+.,hello or +<,.hello
(don’t search for +< ., where the space fails the test)
to recap search for all characters in any order [<+.,]hello (with hello in order)How does one do this in notepad++?
Would love to also only search beginning of lines of text (^\h* as is used in regular expression search)
Help is appreciated! Thanks
-
@maxxsee ,
Generic Regex: Logic Gates for Regular Expressions shows how to use logic in your search/replace, like requiring all the desired terms in no particular order, or one term or another, or other boolean-logic operators. So that should give you a place to start.
----
Useful References
-
@PeterJones said in Search characters if exist in any order with no spaces?:
Hi I did some digging into your text but sadly a bit too hard for me
These are the most I could do currently
([<+.,])(^ h)*hello
(?-s)(?:(?=.*[<+.,])(?=.hello))^.(?:\R|\z)
but neither produced the correct results - first one worked better but it found results with extra characters in the four characters which was unwanted
-
@PeterJones
actually did solve it by excluding line, wow… almost gave up(?-s)(?:(?=.[<+.,])^.(?:\R|\z)(?=.hello))(?!.([aaa]|[bbb]))^.*
where the aaa and bbb are the characters not wanted in search resultsfeel free to post better simpler solution, thanks!
-
Moderator Note: Please do not delete posts after the conversation has happened. It removes context.
(Moderator restored deleted posts; topic being locked, because it appears the original poster is no longer interested, since the posts were deleted)
-
P PeterJones locked this topic on