Remove X characters from start of string?

So I’ve got a string like “_____some text here 123”, and I need just the portion after the 5 underscores - i.e. I simply need to discard the 5 underscores.

The “truncate” operations don’t do it because they preserve X characters at the beginning or end of the string. What I need is a way to “trim” X characters from the start of the string. The only regex that I’ve found to work involves a “look behind assertion” which apparently JavaScript doesn’t support.

Any ideas? :confused:

I’m not sure if this would work for all cases, but this might be worth a try! :slight_smile:

If the string is in the “_____some text here 123” format each time, you can use this regex pattern to extract the text after an underscore:


This will leave a few underscores and the last part of the string. To remove the remaining underscores, you can then use :findandreplace to find all “_” and replace them with nothing.

Preview (green text is the extracted text):


Or, you can possibly use just the :findandreplace option to find “_____” and replace with empty. Regex might only be needed if there is text before the underscores that you don’t need :slight_smile:

1 Like

Holy guacamole, how did I miss that! That’ll do it! Thanks @fayewatson! (I overlooked the obvious.)

Awesome!! :blush: No problem at all @sudsy!

For the sake of completeness, I’m actually using the 5 underscores as a delimiter joining two strings so that I can pass them in a query string as a single parameter.

I’m using regex with a lookahead to extract the first part, but I guess I had regex on the brain, because I totally missed the findandreplace operation.

It would be really handy to have a “split” operation that could break a string into a list based on an arbitrary string as a delimiter. It would also be cool to be able to access regex capture groups as a list as well.

Anyway, thanks again, @fayewatson.