Skip to content
Advertisement

Tag: regex

Forward slash in Bash on Mac

I have this bash(version 3.2 on MacOS) function What it’s suppose to do is run phpunit with proper regex, here i am converting * to (.)* and wrapping filter to be case insensitive. Now The problem is that parsed command works perfectly fine(matched test cases run), when i run directly at terminal. But it does not when function rtf tries

how to create regex to accept combination of alphabets, numbers and special characters but not single alphabet or number or special characters

I want to create regex which will accept combination of alphabets, special characters,numbers but not only alphabets or special characters or numbers For example : It should accept 1 Slice brown bread (wheat) 1 Tbsp 1/2 cup But it should not accept Slice brown bread 1 @#%&%&* This is what I have tried: This regex allow user to accept combination

Regex for 24 hour time

I have found a working expression for accepting only 24 hour time, but my problem is it will accept things before and after such as characters awf23:59fawf 23:59gfes 123:59 Are all accepted, I want to stop allowing this and only accept HH:MM within my statement: if (preg_match_all(“~((2[0-3]|[01][1-9]|10):([0-5][0-9]))~”, $time)) { Answer If you’re wanting to accept only lines that consist solely

PHP regex – replace all text between a tag

I have a link being outputted on my site, what i want to do is replace the visible text that the user sees, but the link will always remain the same. There will be many different dynamic urls with the text being changed, so all the example regex that i have found so far only use exact tags like ‘/.*/’…or

PHP How to add plus (+) character before double quotes and words without double quotes in string [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 6 years ago. Improve this question I have below string: And I want to add plus (+) character before

Advertisement