Repalce string

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
srive99
Posts: 30
Joined: Fri Apr 16, 2010 1:45 pm

Repalce string

Post 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.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Find what: ^[^-]+-[^-]+-
Replace with: [nothing]

[X] Regular expression

Replace All
srive99
Posts: 30
Joined: Fri Apr 16, 2010 1:45 pm

replace after hyphen

Post 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.
Post Reply