Home > database >  return all characters after first occurrence of non letter/number characters - regex
return all characters after first occurrence of non letter/number characters - regex

Time:08-09

If I have a line of text like:

item_id

or

item56**id

And I only want to return the characters after the first non letter/numbers characters, so they would return this:

id

Another example

ginger3!45

turns into 45

What would the regex look like?

CodePudding user response:

Use a capture group to capture everything after the first sequence of non-letters/numbers.

[^a-z0-9] (.*)

The value of $1 or \1 (depending on the application language) will be what you want.

  • Related