I might be missing something
-
Care to post the expression and some sample data?
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
I was replacing s=c&vl=vlg&vi=\d* with a blank string, just a space. It replaces s=c&vl=vlg&vi= and doesn't replace the digits on the end. The digits are 1-3 digits, as in s=c&vl=vlg&vi=1 s=c&vl=vlg&vi=2 s=c&vl=vlg&vi=10 s=c&vl=vlg&vi=11 s=c&vl=vlg&vi=33 s=c&vl=vlg&vi=101 etc. I'd end up with 1 2 10 11 33 101 and, of course, if I just search for that term, it finds all the matches in my file. Oh - is this a case where I need to use a greedy operator ? *doh* (Edit) I don't use regex that often, but it appears to me that my operator is fine, I don't see any alternative to use....(/Edit)
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
modified on Tuesday, June 28, 2011 12:14 AM
-
But isn't it counter intuitive that if I do a search and replace using regex, the regex portion of what I find, is not replaced ? Ooops - in Visual Studio.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
I'm a regex novice, buit wouldn't you have to specify your replacement string as a regex too?
MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')
-
I'm a regex novice, buit wouldn't you have to specify your replacement string as a regex too?
MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')
If I were to use regex at all in the replacement string, I'd be doing a capture in the search and using the captured object in the replacement, which is one level of difficulty above what I was trying to do.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I was replacing s=c&vl=vlg&vi=\d* with a blank string, just a space. It replaces s=c&vl=vlg&vi= and doesn't replace the digits on the end. The digits are 1-3 digits, as in s=c&vl=vlg&vi=1 s=c&vl=vlg&vi=2 s=c&vl=vlg&vi=10 s=c&vl=vlg&vi=11 s=c&vl=vlg&vi=33 s=c&vl=vlg&vi=101 etc. I'd end up with 1 2 10 11 33 101 and, of course, if I just search for that term, it finds all the matches in my file. Oh - is this a case where I need to use a greedy operator ? *doh* (Edit) I don't use regex that often, but it appears to me that my operator is fine, I don't see any alternative to use....(/Edit)
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
modified on Tuesday, June 28, 2011 12:14 AM
Christian Graus wrote:
s=c&vl=vlg&vi=1
s=c&vl=vlg&vi=2
s=c&vl=vlg&vi=10
s=c&vl=vlg&vi=11
s=c&vl=vlg&vi=33
s=c&vl=vlg&vi=101Do you have a whitespace between the "=" & the digits?
It’s always a pleasure to help when your efforts are appreciated...
-
I was replacing s=c&vl=vlg&vi=\d* with a blank string, just a space. It replaces s=c&vl=vlg&vi= and doesn't replace the digits on the end. The digits are 1-3 digits, as in s=c&vl=vlg&vi=1 s=c&vl=vlg&vi=2 s=c&vl=vlg&vi=10 s=c&vl=vlg&vi=11 s=c&vl=vlg&vi=33 s=c&vl=vlg&vi=101 etc. I'd end up with 1 2 10 11 33 101 and, of course, if I just search for that term, it finds all the matches in my file. Oh - is this a case where I need to use a greedy operator ? *doh* (Edit) I don't use regex that often, but it appears to me that my operator is fine, I don't see any alternative to use....(/Edit)
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
modified on Tuesday, June 28, 2011 12:14 AM
I haven't used them for a while (and they're bluddy confusing at the best of times), but if what you're replacing is s=c&vl=vlg&vi=\d*, aren't you also replacing the digits (represented by \d*)? Try deleting \d* from the end of your pattern.
I wanna be a eunuchs developer! Pass me a bread knife!
-
Christian Graus wrote:
s=c&vl=vlg&vi=1
s=c&vl=vlg&vi=2
s=c&vl=vlg&vi=10
s=c&vl=vlg&vi=11
s=c&vl=vlg&vi=33
s=c&vl=vlg&vi=101Do you have a whitespace between the "=" & the digits?
It’s always a pleasure to help when your efforts are appreciated...
No, I do not. The search with the regex, matches these strings, it's the replace that skips the \d* part when it's doing the replacing.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
No, I do not. The search with the regex, matches these strings, it's the replace that skips the \d* part when it's doing the replacing.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Ok try this and give me your feedback:
s=c&vl=vlg&vi=\d*^p$
It’s always a pleasure to help when your efforts are appreciated...
-
I haven't used them for a while (and they're bluddy confusing at the best of times), but if what you're replacing is s=c&vl=vlg&vi=\d*, aren't you also replacing the digits (represented by \d*)? Try deleting \d* from the end of your pattern.
I wanna be a eunuchs developer! Pass me a bread knife!
That what he want to do he want to remove the compete segment along with the digits and he is searching and repacing but the digits are staying and not deleted...
It’s always a pleasure to help when your efforts are appreciated...
-
No, I do not. The search with the regex, matches these strings, it's the replace that skips the \d* part when it's doing the replacing.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
So you are having a lie down in the Lounge? :laugh: :laugh:
Silence is golden... but duct tape is silver!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!
-
That what he want to do he want to remove the compete segment along with the digits and he is searching and repacing but the digits are staying and not deleted...
It’s always a pleasure to help when your efforts are appreciated...
Ah. I read it wrong.
I wanna be a eunuchs developer! Pass me a bread knife!
-
So you are having a lie down in the Lounge? :laugh: :laugh:
Silence is golden... but duct tape is silver!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!
Calvin was practicing drums, and I was waiting on the other end of hte house for him to finish...
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Calvin was practicing drums, and I was waiting on the other end of hte house for him to finish...
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
I was waiting on the other end of hte house for him to finish...
FTFY :laugh:
It’s always a pleasure to help when your efforts are appreciated...
-
Ok try this and give me your feedback:
s=c&vl=vlg&vi=\d*^p$
It’s always a pleasure to help when your efforts are appreciated...
This will not find my values until I remove the ^p and the $. Removing one or the other, still does not work. The number is NOT the end of the line, there's usually a " just after it, and then tons of other stuff. I am replacing URLs. Just to add, s=c&vl=vlg&vi=\d*" works to match the line with the quotes in Expresso, but not in Visual Studio.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Christian Graus wrote:
I was waiting on the other end of hte house for him to finish...
FTFY :laugh:
It’s always a pleasure to help when your efforts are appreciated...
JustWorking wrote:
Christian Graus wrote:
I was waiting on the other end of hte house for him to finish...
FTFY :laugh:
No you didn't!!
Silence is golden... but duct tape is silver!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!
-
This will not find my values until I remove the ^p and the $. Removing one or the other, still does not work. The number is NOT the end of the line, there's usually a " just after it, and then tons of other stuff. I am replacing URLs. Just to add, s=c&vl=vlg&vi=\d*" works to match the line with the quotes in Expresso, but not in Visual Studio.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
What framework you are using?
It’s always a pleasure to help when your efforts are appreciated...
-
What framework you are using?
It’s always a pleasure to help when your efforts are appreciated...
Well, it shouldn't matter, I am doing this in the IDE, not in code. I am using search and replace within Visual Studio. It should work the same no matter what I use. I am editing HTML files.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
JustWorking wrote:
Christian Graus wrote:
I was waiting on the other end of hte house for him to finish...
FTFY :laugh:
No you didn't!!
Silence is golden... but duct tape is silver!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!
_Damian S_ wrote:
JustWorking wrote:
Christian Graus wrote:
I was waiting on the other end of
hte house for him to finish...FTFY :laugh:
No you didn't!!
Yes I did :laugh: I cought Christian saying hte :laugh: Now we shell call him Mr. hte ;P
It’s always a pleasure to help when your efforts are appreciated...
-
Well, it shouldn't matter, I am doing this in the IDE, not in code. I am using search and replace within Visual Studio. It should work the same no matter what I use. I am editing HTML files.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Ok try this:
s=c&vl=vlg&vi=[0-9]*
It’s always a pleasure to help when your efforts are appreciated...
-
Ok try this:
s=c&vl=vlg&vi=[0-9]*
It’s always a pleasure to help when your efforts are appreciated...
Nope - it's obviously the same thing, and it does the same. Matches the numbers fine, but leaves them behind when I replace.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Nope - it's obviously the same thing, and it does the same. Matches the numbers fine, but leaves them behind when I replace.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
How are you replacing? post the code here
It’s always a pleasure to help when your efforts are appreciated...