RegEx to look for word

General questions about using TextPad

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

Post Reply
hoachen
Posts: 9
Joined: Mon Nov 24, 2003 1:21 pm

RegEx to look for word

Post by hoachen »

I am trying to have a regular expression to find and delete those I don't need it. For example.

Summary of this topic.
Capacity: 2090
IP address: 90:400:00
Subnet mask: 255.0.555
Status: Good
ID: 1233

I only want to the whole line for capacity, IP address and I don't need the rest. But, after the colon it might be few spaces or a tab before the any number or text.

After the regex, the result should display:

Capacity: 2090
IP address: 90:400:00
ID: 1234
Status: Good

Is anyone think this is possible to accomplish?

Thanks for reading this post.
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

it is not clear what you really want.

You write that you only want to keep lines containing capacity and ip address.
But in the result you want to hav, there are ID and status lines as well (in changed order, and with increased ID value).


If you only want to keep lines with capacity and ip:

clear all bookmarks
find capacity, mark all
find ip address, mark all
invert all bookmarks
delete bookmarked lines.
hoachen
Posts: 9
Joined: Mon Nov 24, 2003 1:21 pm

Post by hoachen »

I need the entire line.

Capacity: 2090
IP address: 90:400:00
ID: 1234
Status: Good
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

WHICH ENTIRE LINE?
You show four lines and tell us you need _THE_ whole line ...

You are confusing. You originally show a six-line text sample, tell us you need only the two lines containing ip and capacity, but the wanted result shows four lines (with changed order and changed content). And then you tell us you need only one line, but that line completely, and again show four lines as wanted result.


Sorry, I can't think of any way to produce a single line result containing four lines, two of which you told us you don't need ...
hoachen
Posts: 9
Joined: Mon Nov 24, 2003 1:21 pm

Post by hoachen »

I might left out other two items on the description part, but not confuse as you thought.

Never mind. I figure it out.

Thanks!
User avatar
bloodbaz
Posts: 7
Joined: Thu Sep 11, 2003 11:03 pm

Post by bloodbaz »

I suggest you try MudGuard's bookmark approach.
You can adapt his approach to choose whichever lines you want to keep or remove. The approach by definition works on whole lines as you were asking for.
Post Reply