If we can assume that SOMEURL
and first-category
don't contain digits, we can simply search for the first non-empty string of numbers and delete everything else.
Pattern:
Find what: (.*?)(\d+).*
Replace with: \2
How it works:
.*
is any arbitrary string of characters
?
makes .*
lazy, i.e., it matches as few characters as possible
\d+
is a non-empty string of digits
()
groups characters, where \2
refers to the second group
For more information about Regular Expressions, click here.
Example:
http://www.SOMEURL.com/first-category/1343381-example-text-text-text-2000-a.html
http://www.SOMEOTHERURL.com/some-category/1343382-example-more-text-2001-b.html
gets replaced with
1343381
1343382