I couldn't figure out from the thread if you wanted to keep tabs, get
rid of them, or just have the result and add a tab on either side.
Let me go over what all the giberish means by breaking down :
<a href=[^\r>]+>([^\r<]+)</>
( 1 ) <a href=
( 2 ) [^\r>]+
( 3 ) >
( 4 ) ([^\r<]+)
( 5 ) </>
I'll give the sample string a name and number ( Str_1 ) , so I can
refer to it below...
( Str_1 ) <a href=ST107V1.html target='_blank'>MLV1F107</>
( Str_2 ) <a href=Anything.html target='_blank'>SOMEVALUE</>
I couldn't figure out from the thread if you wanted to keep tabs, get
rid of them, or just have the result and add a tab on either side.
Let me go over what all the giberish means by breaking down :
( Find_1) <a href=[^\r>]+>([^\r<]+)</>
Item ( Find_2) below means the same thing as ( Find_1), but might be a
little easier to follow :
( Find_2) <a href=[^>\r]+>([^<\r]+)</>
( 1 ) <a href= --> <a href=
( 2 ) [^>\r]+ --> ST107V1.html target='_blank'
( 3 ) > --> >
( 4 ) ([^<\r]+) --> SOMEVALUE
( 5 ) </> --> </>
( 1 ) find a string that contains "<a href=", if this string starts at
the beginning of a line then you would use "^<a href=" where the up
caret means "starting at the beginning of a line" find whatever is
after the up caret.
( 2 ) [^\r>]+ would have been clearer if I had written [^>]+, where
the up character here means "IS NOT", or "NEGATION". In this case [>]
simply means the ">" character, where [^>] means any character that is
not ">", the "+" just means "one or more characters".
So [^>]+ means a string that does not contain ">", and either [^>\r]+
or [^\r>]+ means any string of characters that does not contain either
">" or a carriage return "\r"
So, so far we know that we are looking for a string beginning (not
necessarily at the beginning of the line) with ( 1 ) followed by a
string of characters that does not contain either ">" or a carriage
return "\r".
( 3 ) Followed by the ">", therefore we now have :
so far ( 1 ) ( 2 ) ( 3 ) : <a href=[^>\r]+>
will find in ( Str_1 ): <a href=ST107V1.html
target='_blank'>
will find in ( Str_2 ): <a href=Anything.html
target='_blank'>
( 4 ) ([^<\r]+) means [^<\r] any character that does not contain
either "<" or a carriage return "\r" and if we put a "+" after [^<\r]+
makes it one or more characters, or a string that does not contain
either ">" or a carriage return "\r". The "(" and ")" simply mean save
whatever is inside the parentheses so it can be referred to in the
replace part of the solution. Since this is the only portion of the
search string surrounded by parentheses, it becomes \1
Which gives us so far :
so far ( 1 ) ( 2 ) ( 3 ) ( 4 ) : <a href=[^>\r]+>([^<
\r]+)
will find in ( Str_1 ): <a href=ST107V1.html
target='_blank'>MLV1F107
will find in ( Str_2 ): <a href=Anything.html
target='_blank'>SOMEVALUE
( 5 ) Followed by the end of the string you are looking for.
Apparently whatever you are using so far has changed "</a>" to "</>",
anyway for your purposes it doesn't matter, use what you have at hand.
So if we look for <a href=[^>\r]+>([^<\r]+)</> and replace it with \1
we will have what we are looking for.
The tab character is represented by \t, so you can add or replace tabs
using it.
Best Regards,
Bill Hernandez
Plano, Texas
On Oct 27, 2009, at 12:15 AM, Bill Hernandez wrote:
> SEARCH : <a href=[^\r>]+>([^\r<]+)</>
> REPLACE : \1
>
> will leave : MLV1F107
>
> Best Regards,
>
> Bill Hernandez
> Plano, Texas
>
> On Oct 26, 2009, at 11:39 PM, Chaz Larson wrote:
>
>> <tab><a href=ST107V1.html target='_blank'>MLV1F107</><tab>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
-~----------~----~----~----~------~----~------~--~---