Find one word and other not present in the line

Find, replace, find in files, replace in files, regular expressions

Find one word and other not present in the line

Postby gllanderas » Wed Sep 08, 2004 5:11 am

I want to find all the lines that have the text '<td' and that not have 'class'. How can I do?

That is, I want to find lines like:

<td>
<td style=''>

but not lines like:

<td width='' class=''>
<td class=''>

Thanks. :)
User avatar
gllanderas
Newbie
 
Posts: 4
Joined: Tue Sep 07, 2004 11:00 pm

Re: Find one word and other not present in the line

Postby Mofi » Thu Sep 09, 2004 1:46 am

What you want is not possible with a single regular expression search. UltraEdit has not feature to search for something, which does not contain some specified words.

It would be useful, if IDM would add a new entry field in all find and replace dialogs, where users can specifiy words, which should not be part of a search result .

For example:

Find: <td*>
Not: class

So UltraEdit finds first "<td>", test if this search result contains "class" and because it is not in the result, the first search result is "<td>".

Next UltraEdit finds "<td style='...'>", test if this search result contains "class" and because it is not in the result, the second search result is "<td style='...'>".

Next UltraEdit finds "<td width='xx' class='...'>", test if this search result contains "class" and because it is in the result, this search result is ignored.

Last UltraEdit finds "<td class='...'>", test if this search result contains "class" and because it is in the result, this search result is also ignored.

What do you (all users of UE) think about this? Should I mail an feature request to IDM?

--------

As quick workaround for the problem is, that you could write a macro to search for <td*> and write the results to a new file and remove in a second step those lines, which contain the word class. Don't know, if this would be useful in your situation. I guess, it would not.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4069
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Find one word and other not present in the line

Postby DanKirkd » Thu Sep 09, 2004 12:10 pm

Sounds like a good suggestion.

Dan
User avatar
DanKirkd
Basic User
Basic User
 
Posts: 39
Joined: Wed Jul 14, 2004 11:00 pm

Re: Find one word and other not present in the line

Postby gllanderas » Fri Sep 10, 2004 1:44 am

Thanks for the answer, Mofi. :)


Mofi wrote:As quick workaround for the problem is, that you could write a macro to search for <td*> and write the results to a new file and remove in a second step those lines, which contain the word class. Don't know, if this would be useful in your situation. I guess, it would not.


It sounds to complex, perhaps a C program will be more easy to do.

I prefer your idea of request this feature to IDM. :))
User avatar
gllanderas
Newbie
 
Posts: 4
Joined: Tue Sep 07, 2004 11:00 pm

Re: Find one word and other not present in the line

Postby majingh » Thu Dec 27, 2007 5:58 pm

gllanderas wrote:I want to find all the lines that have the text '<td' and that not have 'class'. How can I do?

That is, I want to find lines like:

<td>
<td style=''>

but not lines like:

<td width='' class=''>
<td class=''>

Thanks. :)


For perl style regular expression, can we do this:

<td[[:alpha:]]*[^c][^l][^a][^s][^s]"=>
User avatar
majingh
Newbie
 
Posts: 4
Joined: Wed Dec 26, 2007 12:00 am


Return to Find/Replace/Regular Expressions