- Ctrl+H
- Find what:
(<title>(\S+)(\s+\S+)?(\s+\S+)?(\s+\S+)?(\s+\S+)?(\s+\S+)?(\s+\S+)?(\s+\S+)?(\s+\S+)?(\s+\S+)?(\s+\S+)?(\s+\S+)?(\s+\S+)?</title>[\s\S]+?<meta name="keywords" content=")[^"]+
- Replace with:
$1(?2$2)(?3,$3)(?4,$4)(?5,$5)(?6,$6)(?7,$7)(?8,$8)(?9,$9)(?10,$10)(?11,$11)(?12,$12(?13,$13)(?14,$14)
- UNCHECK Match case
- CHECK Wrap around
- CHECK Regular expression
- UNCHECK
. matches newline
- Replace all
Explanation:
( # start group 1
<title> # literally, open tag
(\S+) # group 2, 1 or more non-space
(\s+\S+)? # group 3, 1 or more space followed by 1 or more non-space
(\s+\S+)? # group 4, 1 or more space followed by 1 or more non-space
(\s+\S+)? # group 5, 1 or more space followed by 1 or more non-space
(\s+\S+)? # group 6, 1 or more space followed by 1 or more non-space
(\s+\S+)? # group 7, 1 or more space followed by 1 or more non-space
(\s+\S+)? # group 8, 1 or more space followed by 1 or more non-space
(\s+\S+)? # group 9, 1 or more space followed by 1 or more non-space
(\s+\S+)? # group 10, 1 or more space followed by 1 or more non-space
(\s+\S+)? # group 11, 1 or more space followed by 1 or more non-space
(\s+\S+)? # group 12, 1 or more space followed by 1 or more non-space
(\s+\S+)? # group 13, 1 or more space followed by 1 or more non-space
(\s+\S+)? # group 14, 1 or more space followed by 1 or more non-space
</title> # end tag
[\s\S]+? # 1 or more any character, including newline
<meta name="keywords" content=" # literally
) # end group 1
[^"]+ # 1 or more any character that is not a quote
Note: This is working for up to 13 words, you can add as many groups as needed if you have more than 13 words
Replacement:
$1 # content of group 1
(?2$2) # if group 2 exists, insert it
(?3,$3) # if group 3 exists, insert a comma then content of group 3
(?4,$4) # idem for group 4
(?5,$5) # idem for group 5
(?6,$6) # idem for group 6
(?7,$7) # idem for group 7
(?8,$8) # idem for group 8
(?9,$9) # idem for group 9
(?10,$10) # idem for group 10
(?11,$11) # idem for group 11
(?12,$12) # idem for group 12
etc.
Note: Add other groups if needed.
Screenshot (before):
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/OKklH.png)
Screenshot (after):
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/AmZma.png)