Skip to content
Advertisement

Regex to find and expression and insert into the middle

I’ll be brief as I can. I’m trying to use preg_replace’s regex to find a digit, but I want to non destructively edit the string.

an example: (albeit this is an approximation due to data protection)

JavaScript

Any help would be gratefully received

Advertisement

Answer

Use

JavaScript

Replace with <hr/>$0. See regex proof.

EXPLANATION

JavaScript

Code snippet:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement