Skip to content

Tag: regex

Return a substring of a string if exists

I need to extract console platform from the description of products in CSV file. I used regex to match all the console brands that are included in the list. This is for WP All-Import plugin PHP …

Regex letters are not allowed when they should be?

My and my group are trying to create a simple PHP code editor that also executes the code without the use of a library. We know the risks that come with eval(), but since it’s all running on a local server it shouldn’t be a problem. The Regex part is definitely the problem since we have no clue ho…

how to “regex” all options in select menu

The sample data is this: With the following code I can capture only one data: How can I capture all data to “SIZExSIZE” (e.g 50×80 or 150×230) and “Stock: [0-9]” until the last Select. Answer Just change (.*) by ([sS]*?)</select> so the complete regexp would be: <sel…

preg_match include string with unlimit occurence

I trying to create preg_match function with a pattern to validate the future string with unlimit occurence. This is my function like this: One occurrence must respect the following format any charchters between two parentheses: (mystring123/). The whole of string ($arg) is a collection of these occurrences. F…