Hi, I am having a little difficulty with regexes, as you have already probably guessed from the title.
Actually, I've learned them a few times now. But every time I need to use one, I need to learn them again. They just don't want to stay in my head.
Basically, what I want to achieve, is to match a specific letter, and all the letters that follow after it, until it reaches another character(which isn't anymore a letter). I want to do it for Cyrillic letters, if that matters. But it should be the same thing as for Latin ones, I guess.
I am using http://www.functions-online.com/preg_replace.html to test as soon as I find something that might solve the task.
Here's what I'm testing with now:
January almost works.
February is a little worse.
March just doesn't.
In January, I think I only need to make it not stop after same matches? I tried placing a dot before the plus ('/я[а-я].+[^а-я]/'), but then it returned only "january".. xD
Thanks for any help in advance!
[E] The result from this should be "january february some english march".
Actually, I've learned them a few times now. But every time I need to use one, I need to learn them again. They just don't want to stay in my head.
Basically, what I want to achieve, is to match a specific letter, and all the letters that follow after it, until it reaches another character(which isn't anymore a letter). I want to do it for Cyrillic letters, if that matters. But it should be the same thing as for Latin ones, I guess.
I am using http://www.functions-online.com/preg_replace.html to test as soon as I find something that might solve the task.
Here's what I'm testing with now:
$pattern = array('/я[а-я]+[^а-я]/', '/ф[\p{L}]+[^\p{L}]/', '/м[\p{Cyrillic}][^\p{Cyrillic}]/')
$replacement = array('january', 'february', 'march')
$subject = януари февруари some english март
January almost works.
February is a little worse.
March just doesn't.
In January, I think I only need to make it not stop after same matches? I tried placing a dot before the plus ('/я[а-я].+[^а-я]/'), but then it returned only "january".. xD
Thanks for any help in advance!
[E] The result from this should be "january february some english march".