Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a regex match the next 4 characters immediately after finding something?

Tags:

regex

I'm trying to write a regex to sift through a sizable amount of data. After it finds something, I want it to match the next 4 characters whatever they are. How can I do this?

like image 593
John Avatar asked Jan 27 '26 02:01

John


1 Answers

/match long stuff here..../

The . in a regex is "Any character." Four of them gets you four characters. You could also do:

/match long stuff here.{4}/

This may depend on what language you are writing your regex in.

like image 72
Phrogz Avatar answered Jan 28 '26 20:01

Phrogz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!