I'm busy inserting my url aliases into a database. And need to make insert queries from the list of values i have.
A few items from my list:
(NULL, 'tag=23525','2807016'),
(NULL, 'tag=23525','10165'),
(NULL, 'tag=23525','12165'),
I'd love to have a regex expression which can find tag=23525 and can replace it with the number behind it. So the list will end up looking like this:
(NULL, 'tag=2807016','2807016'),
(NULL, 'tag=10165','10165'),
(NULL, 'tag=12165','12165'),
I've managed to find the text tag=23525 (wow so hard). But i'm stuck with the finding (the replace) of the number behind.
I can find the last number easily with this regex but can't replace with this regex:
^[^,]*,[^,]*,[^,]*\\b(\\w+)\\b
How am i able to find and replace tag=23525
with the match found from the regex?
(?<=tag=)\d+('\s*,\s*')(\d+)
You can use this.Replace by $2$1$2
or \\2\\1\\2
.See demo.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.