i have a list of key=>value pairs from a JSON squirt. i sorted the array and i’m left with the following (excerpted relevant cases because they go as high as 92): what i need to do is: 1) place all the digits at the end and 2) pad them to 2 digits (01,02,&c) so the list ends up looking like
Tag: regex
Regex for splitting apparel sizes
I have the following input (only for example, real input contains much more crazy data) and want to split it by separators like / or , but keep pairs of values. This should be done only, if separator does not occur multiple times, so the result should look like: What I have so far is But this fails for 40/42/44/46/48
PHP preg_replace: Replace All Hyphens in String That Appear Before the Last Hyphen w/ Space
Using preg_replace (or other PHP-based option): I need to replace all hyphens in a string, that appear before the last hyphen, with space. Example #1 of the Result I Need: string = My-Cool-String – …
Is there any option to separate special characters from words with regex/preg_split?
I’m junior and not at ease with regex, and I’m trying to do a password generator with sentences using regex and preg_split. All is done except one thing, for example the sentence “I’ve got 2 cats.” …
Capturing groups in string using preg_match
I got in trouble parsing a text file in codeigniter, for each line in file I need to capture groups data…the data are: – progressive number – operator – manufacturer – model – registration – type …
Extract specific data from string using Regex (PHP)
My objective is to check if the message have emojis or not , if yes i am going to convert them. I am having a problem to find out how many emojis are in the string. Example : $string = “:+1::+1::+…
I have an array of regex I am replacing with the same character. How would I use or “|” with my regex to lower array count?
I have more setup in my arrays but to keep it simple I’m only placing the ones with which I want to group together using or “|”. $patterns = array(); $patterns[1] = “/(?::)/”; $patterns[2] = “/(?:-…
regex preg_replace php
I have random variable like: Strip @ 489.000 Strip 1 @ 489.000 Strip 2 @ 589.000 I need output will be: only number after ‘anything @ ‘ 489.000 so give me output: 489.000 489.000 589.000 hot to …
encoding language fails
PHP code below fails to retrieve correct characters when used : echo $html = file_get_contents(“http://www.tsetmc.com/tsev2/data/instinfofast.aspx?i=65883838195688438&c=34+”); the result is : …
Laravel validate regex not allow kanji char
I want to validate a form input which not allow input kanji char using Laravel validate rule. How to do it? This is what I did: public function validationRules() { return [ ‘name’ => ‘…