help using find / search for multiple words

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
trangen
Posts: 16
Joined: Tue Jul 17, 2007 12:08 am
Location: Los Angeles CA USA

help using find / search for multiple words

Post by trangen »

I can't seem to find 2 separate string of characters.

How do I do this? can some one help please?

I need to search for
inbound
10.104.8.140

I tried
"inbound" "10.104.8.140"
\inbound\ \10.104.8.140\

Thanks in advance
To Me or Not To Me
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Do you mean you want to find either inbound or 10.104.8.140?

This will do that:
Find what: inbound|10.104.8.140

[X] Regular expression
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Last edited by ben_josephs on Tue Feb 12, 2008 11:43 pm, edited 1 time in total.
trangen
Posts: 16
Joined: Tue Jul 17, 2007 12:08 am
Location: Los Angeles CA USA

Need to find them both on the same line

Post by trangen »

Ben not or, AND

I need to find them both on the same line.

Going through the syslogs and I I can find single items but not both on the same line
To Me or Not To Me
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Find what: inbound.*10.104.8.140|10.104.8.140.*inbound

[X] Regular expression
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
trangen
Posts: 16
Joined: Tue Jul 17, 2007 12:08 am
Location: Los Angeles CA USA

Thanks Ben that worked

Post by trangen »

Thank you very much Ben, that worked!

all I needed was this part

inbound.*10.104.8.140

So the dot . is the (and separator), and the * asterics is the wild card to search for and match subsequent string.

Funny how I looked that up in the Help file and it doesn't show it.

I think I'll enter it as a feature request.

Thanks again,
To Me or Not To Me
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Check the Help file again, look for How to Use Regular Expressions.

The dot is not a separator, it is actually the wild card, stands for any character.

And the * is for any number of the wildcard characters.

The "|" is the OR character.


So this is looking for any number of characters in between the two strings.
And the OR symbol is allowing the strings to come in either sequence.
Hope this was helpful.............good luck,
Bob
trangen
Posts: 16
Joined: Tue Jul 17, 2007 12:08 am
Location: Los Angeles CA USA

Thanks Bob

Post by trangen »

Ok, Thanks Bob for answering that and clearing that up.

per your suggestion, I went back to check the help file again,
and no where does it give such example or explanation.

the version I have is 5.0.3

I think something so basic should be put in the help file.

I did put it in for a feature request for this today, if you check in the
"Enhancement Suggestions"

or maybe it was added in a newer Rev than mine.


Thanks again
To Me or Not To Me
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

I have also responded to the Enhancements postings.

From the How To Use Regular Expressions Help:
\|
|
Matches either the expression to its left or its right.
Example: hop\|hoop matches hop, or hoop.


I agree, it is not much, but see my other reply.
Hope this was helpful.............good luck,
Bob
trangen
Posts: 16
Joined: Tue Jul 17, 2007 12:08 am
Location: Los Angeles CA USA

thanks

Post by trangen »

I didn't need an OR, just the AND, as in BOTH words
To Me or Not To Me
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Hi trangen ....

I am really trying to help here, so please do not take my comments as criticism. The use of .* is more complex.

But disneyland.*california will not be limited to the words disneyland and california. It would also find disneylandworld followed by northerncalifornia or any other situations that include disneyland and california in a larger string

California might not be a good example. But, if you wanted the word "the" and "car", using the.*car would get words like them, these, heathen, cartoon, racecar, Carl, carpet, etc.

And the.*|.*car would do the same, only in an OR situation vs. a sequential one.

To get just the exact words, the RegEx needs to be more complex, defining words, and/or inserting space characters, the number of characters, etc. Your original search, inbound.*10.104.8.140 will also locate the two additional IPs of 110 and 210.104.8.140
Hope this was helpful.............good luck,
Bob
trangen
Posts: 16
Joined: Tue Jul 17, 2007 12:08 am
Location: Los Angeles CA USA

Thanks

Post by trangen »

I C, I C, said the blind man.

Just trying 2 b helpful, 4 others who might have been stuck w the similar situation.

Great Product!

Thanks Bob
To Me or Not To Me
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

No problem.

I am still struggling with RegEx.
Here's a big thanks to ben_josephs for all of his help.
Hope this was helpful.............good luck,
Bob
trangen
Posts: 16
Joined: Tue Jul 17, 2007 12:08 am
Location: Los Angeles CA USA

one last questions please

Post by trangen »

ok, since were on the subject.

How do I do this please?

how do I run 2 searches at the same time.
E.g.

I want to find:

inbound.*10.104.8.140
inbound.*10.104.9.17

I want to find ALL lines that have either inbound.*10.104.8.140 and
inbound.*10.104.9.17

I know they will BOTH NOT be on the same line.
they will be on separate lines.
To Me or Not To Me
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Find what: (inbound.*( |0)10.104.8.140)|(inbound.*( |0)10.104.9.17)

This assumes that "inbound" is always before the IP address on the lines.

This will select strings that include "inbound" and the IPs, it is not limited to those specific words/IPs. See my earlier post.

There is a leading space char or a zero in front of the IPs to prevent 110 and 210 addresses from being selected. But, this does require a space or a zero for a match. Any other char will not match.
==============================
Open Find Window, use the following settings:
-----------------------------------------
[X] Regular expression
Mark All
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------
Hope this was helpful.............good luck,
Bob
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Or
inbound.*(\<10.104.8.140|\<10.104.9.17)

Solving these problems gives me a break from solving other problems. :-)
Post Reply