Replace second grouping with first

Published on Tue Mar 01 2022

Identifies two groups, each group using a regex, then replaces group 2 with group 1.

Additional matching regexes for
Replace second grouping with first

Replace second grouping with first

Identifies two groups, each group using a regex, then replaces group 2 with group 1.

match arguments similar to shell, supports quoted string

first group matches quoted strings second group plain text, arguments are separated with a space. example: "this is a \"string\"" thisisnot "another \"string\" with a backslash \"\\"" just replace \" with " after matching.

AMEX, VISA, MASTERCARD, and DISCOVER REGEX

First pass at a way to find credit card data using regex.

Replace second (or further) html statement in a whole code

This regex replace the second tag content which has the prefix ":". If you want to replace the third, just increase the statement {1} to {2}, and so go on.

Mask an email regex

Replaces second to last but one characters in email with asterisks (@ and last . are protected): [email protected] > j***********[email protected]****.**m

IPv4 + TCP-Port

This regex matches a IPv4 with a TCP Port (1-65535) Example: `192.168.0.69:1337` will match and have the groups: - Group 1: `192.168.0.69` - Group 2: `1337`

CamelCase parsing helper

Helper regex for parsing CamelCase identifiers. Captures the first word of the identifier in group 1 and the rest in group 2. Iterate to consume the whole name. Works on fooBar, FooBar, and FOOBar.

replace-last-comma with semicolon

replace-last-comma with semicolon similar to http://stackoverflow.com/questions/3829483/how-to-replace-last-occurrence-of-characters-in-a-string-using-javascript

Identify lines on an invoice

it identifies lines in an invoice

Simple first exercise of a newbie

Find a group of 9 letters subdivided in groups of three by a dash.