Help searching for two items with a wildcard inbetween...
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 10
- Joined: Tue Nov 14, 2006 2:29 am
Help searching for two items with a wildcard inbetween...
I'm searching for: ServerFilter=""
and: ""
With anything inbetween... so it'd look something like:
ServerFilter=""BLAHBLAHBLAHBLAH""
and i want to just be left with the BLAHBLAHBLAHBLAH
and: ""
With anything inbetween... so it'd look something like:
ServerFilter=""BLAHBLAHBLAHBLAH""
and i want to just be left with the BLAHBLAHBLAHBLAH
"Education is the progressive realization of our own ignorance" - Sir Albert Einstein
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Are the ServerFilter="" and "" parts both on the same line? Then:
This assumes you are using Posix regular expression syntax:Find what: ServerFilter=""(.*)""
Replace with: \1
[X] Regular expression
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-
- Posts: 10
- Joined: Tue Nov 14, 2006 2:29 am
Your find and replace DID work... but instead of it replacing with the text that was inbetween my 'find' items, it replaced it with literally "\1".
And to answer your first question, I BELIEVE all of the strings are on individual lines and not split.
"This assumes you are using Posix regular expression syntax:"
Where do I configure that at? Am I also supposed to be using TextPad? Because I'm not, I only have a license for WildEdit.
**UPDATE** I found the top option on WildEdit of the "Options Tab" under the "Syntax options" settings that says "Use POSIX extended, rather than ECMAScript syntax rules" so I've checkmarked that I'm trying it right now.
And to answer your first question, I BELIEVE all of the strings are on individual lines and not split.
"This assumes you are using Posix regular expression syntax:"
Where do I configure that at? Am I also supposed to be using TextPad? Because I'm not, I only have a license for WildEdit.
**UPDATE** I found the top option on WildEdit of the "Options Tab" under the "Syntax options" settings that says "Use POSIX extended, rather than ECMAScript syntax rules" so I've checkmarked that I'm trying it right now.
"Education is the progressive realization of our own ignorance" - Sir Albert Einstein
-
- Posts: 10
- Joined: Tue Nov 14, 2006 2:29 am
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
-
- Posts: 10
- Joined: Tue Nov 14, 2006 2:29 am
I'm really sorry for posting in the wrong forum, but thank you for your help!
I'm also sorry for not bringing this up earlier, but what if I've got multiple occurences of the string to find and replace all on the same line of text?
Cause it still seems to not be working how I'd like it too, and I'm thinking that's why.
Thank you again ben_josephs. You're awesome for all the help you're giving me.
I'm also sorry for not bringing this up earlier, but what if I've got multiple occurences of the string to find and replace all on the same line of text?
Cause it still seems to not be working how I'd like it too, and I'm thinking that's why.
Thank you again ben_josephs. You're awesome for all the help you're giving me.
"Education is the progressive realization of our own ignorance" - Sir Albert Einstein
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
In WildEdit regular expressions:
A subexpression constructed with the * operator is greedy; it matches as much as possible. For example, the subexpression .* of the regular expression x.*y is greedy. If you use x.*y to search the text
x_stuff_y_x_more_stuff_y
the subexpression .* matches
_stuff_y_x_more_stuff_
and the whole expression matches the entire text.
On the other hand, a subexpression constructed with the operator *? is non-greedy; it matches as little as possible. In the above case x.*?y matches first
x_stuff_y
then
x_more_stuff_y
So the regular expression you need is
ServerFilter=""(.*?)""
A subexpression constructed with the * operator is greedy; it matches as much as possible. For example, the subexpression .* of the regular expression x.*y is greedy. If you use x.*y to search the text
x_stuff_y_x_more_stuff_y
the subexpression .* matches
_stuff_y_x_more_stuff_
and the whole expression matches the entire text.
On the other hand, a subexpression constructed with the operator *? is non-greedy; it matches as little as possible. In the above case x.*?y matches first
x_stuff_y
then
x_more_stuff_y
So the regular expression you need is
ServerFilter=""(.*?)""
-
- Posts: 10
- Joined: Tue Nov 14, 2006 2:29 am
I always wondered what they meant by greedy or non-greedy... Now it all makes sense. You're so awesome ben_josephs.
Thank you for your patience and help.
Your search expression works awesome, but the replace isn't replacing my "(.*?)"
It's putting in it's place either "$1" or "\1" when I try either one, and I've tried both with both "Use POSIX extended, rather than ECMAScript syntax and rules" checked and un-checked. So I dunno what the deal is now -_-.
Do I need to change any other options? like replace format, or my character endcoding? (it's currently set at the default of "windows-1252")
Thank you for your patience and help.
Your search expression works awesome, but the replace isn't replacing my "(.*?)"
It's putting in it's place either "$1" or "\1" when I try either one, and I've tried both with both "Use POSIX extended, rather than ECMAScript syntax and rules" checked and un-checked. So I dunno what the deal is now -_-.
Do I need to change any other options? like replace format, or my character endcoding? (it's currently set at the default of "windows-1252")
"Education is the progressive realization of our own ignorance" - Sir Albert Einstein
-
- Posts: 10
- Joined: Tue Nov 14, 2006 2:29 am