Skip to content
Advertisement

Tag: preg-replace

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 …

When do I need u-modifier in PHP regex?

I know, that PHP PCRE functions treat strings as byte sequences, so many sites suggest to use /u modifier for handling input and regex as UTF-8. But, do I really need this always? My tests show, that this flag makes no difference, when I don’t use escape sequences or dot or something like this. For example preg_match(‘/^[da-f]{40}$/’, $string); to check

Remove pieces of string

Ok, ive imported contents of .txt file into array, and im having problems with removing some parts of the string in array. This is the sample output of the array: [55] => …

Advertisement