Skip to content

One line PHP regex search

Not sure this is the best way to do this, but it works.

Working on a project and I’m writing a lot of code to do RegEx searches. Each match is 3 or 4 lines to do the match, check if there was a match, and then do something with the match. Since I was tired of typing the same code over and over, kicked out a little function to do it for me.

It also was an excuse to try out Gists and embedding them back on my site instead of putting the code directly in a post.

Published inCoding

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *