Manish Sharma
Manish Sharma

Reputation: 2426

How can I change tag brackets using RegEx?

I want to use RegEx to change < to [ and > to ].

Example input:

<mailto:[email protected]>

Example output:

[mailto:[email protected]]

The email address obviously changes in each instance.

Upvotes: 1

Views: 179

Answers (2)

Ro Yo Mi
Ro Yo Mi

Reputation: 15010

Description

If you're replacing all the <mailto:..> tags in an existing HTML doc then you're going to need something like:

regex: <(mailto:[^>]*)>

replace with: [$1]

enter image description here

Upvotes: 1

Stephan
Stephan

Reputation: 43053

Regex

<([^>]+)> 

Replacement

[$1]

Upvotes: 1

Related Questions