Page 1 of 1

Repalce string

Posted: Fri Aug 06, 2010 4:43 pm
by srive99
Hi All,
I have a string as follows..
something-somenubmer-somethingelse_some

I wanted to use "replaceall" to remove untill second hyphen (including hyphen). Out put should be as below...

"somethingelse_some"

since I have bunch of strings, I'm not getting, how I can do with regular expression.

Posted: Fri Aug 06, 2010 8:05 pm
by ben_josephs
Find what: ^[^-]+-[^-]+-
Replace with: [nothing]

[X] Regular expression

Replace All

replace after hyphen

Posted: Tue Aug 10, 2010 2:55 pm
by srive99
It looks like this one worked for me
^([^-].*)-
But I need other one like if I have string like

some-some-some-somthing

It finds "some-some-some-" and I replace with null.

But I want now is it should find "-some-some-somthing" and I need to replace that with null.
Any one have an idea how i can do that.