Sometimes you may want to tint an image or add a gradient. This can obviously be done with an image editor like Photoshop, but it can also be done purely with CSS using the background property. Using CSS to do this instead of changing the image itself saves time if modifications to the image style […]
RegEx to get the Root Domain from a String of HTML
June 25, 2016 by Leave a Comment
Extracting URL’s from a string of HTML text using the php preg_match_all() function can grab you an array of the full URLs or an array of just the root domains depending on the RegEx used. I’ll provide a premade function snippet that you can use for both. The only difference between these two functions is […]
RegEx to Find a Word within a String Using preg_match
June 25, 2016 by Leave a Comment
When using preg_match to find a word in a string, you’ll find that the default regex used in most examples (ex: “/needle/i” ) works perfectly fine for finding if a pattern occurs in the string, but if you are looking to find a specific word it can get you unexpected results. For example, if we want […]