PHP Regular expression flags
Can someone explain what the 'e' flag does, or link me to somewhere that does? I couldn't find anything via google. Example: preg_replace("/a(b?)c/e", "search_foo_term('\$1')", $str); ...
Can someone explain what the 'e' flag does, or link me to somewhere that does? I couldn't find anything via google. Example: preg_replace("/a(b?)c/e", "search_foo_term('\$1')", $str); ...
Hi Guys, Consider these three mysql statements: select * from Users; select id, title, value from Blogs; select id, feelURL, feelTitle from Feeds where id = 1; Now im not very good at REGEX, but i want to get the table name from the mysql query. Could someone possibly create one for me with a little explanation. Thanks, ...
Hi, i'm using preg_match_all('/<?(.*)?>/', $bigString, $matches, PREG_OFFSET_CAPTURE); to find the contents of everything between <? and ?> Now I'd like to find everything that is NOT between <? and ?> I'm trying with preg_match_all('/^(<?(.*)?>)/', $bigString, $nonmatches, PREG_OFFSET_CAPTURE); but that doesn't seem to work... ...
I now split the sting op , only like this: $a_string = preg_split('/[,]/', $sting); I also want to split the sting on " and " but i can't find the right regex. ...
I need to make a replace of a plus sign in a javascript string. there might be multiple occurrence of the plus sign so I did this up until now: myString= myString.replace(/+/g, "");# This is however breaking up my javascript and causing glitches. How do you escape a '+' sign in a regular expression? ...
Hi Guys, I have been using the java.util.regex.* classes for Regular Expression in Java and all good so far. But today I have a different requirement. For example consider the pattern to be "aabb". Now if the input String is aa it will definitely not match, however there is still possibility that if I append bb it becomes aabb and it ma...
Hi, I want to use validates_format_of to validate a comma separated string with only letters (small and caps), and numbers. So. example1, example2, 22example44, ex24 not: ^&*, <> , asfasfsdafas<#%$# Basically I want to have users enter comma separated words(incl numbers) without special characters. I'll use it to validate tags from...
Hi all, I'm horrible with regex but i'm trying to figure out how an import function works and i came across this regex pattern. Maybe one of you can help me understand how it works. string pattern = @"^""(?<code>.*)"",""(?<last_name>.*)"",""(?<first_name>.*)"",""(?<address>.*)"",""(?<city>.*)"",""(?<state>.*)"",""(?<zip>.*)""$"; Regex ...
Ok, I'm a bit of a n00b when it comes to JS (I'm not the greatest programmer) so please be gentle - specially if my questions been asked already somewhere and I'm too stupid to find the right answer. Self deprecation out of the way, let's get to the question. Problem There is a site me and a large group of friends frequently use which ...
I have a string containing something like this "Hello bla bla bla bla ok, once more bla können. // this is static: it doesn't change This is a text, this also a text. // this is dynamically added text it can change each time My name mysurename // this is also static text www.blabla.com " Now I have content and I have to get the ...
I'm trying to complete a regular expression that will pull out matches based on their opening and closing characters, the closest I've gotten is ^(\[\[)[a-zA-Z.-_]+(\]\]) Which will match a string such as "[[word1]]" and bring me back all the matches if there is more than one, The problem is I want it to pick up matchs where there may...
I'm trying to locate the number of matches in a relative path for directory up references ("..\"). So I have the following pattern : "(\.\.\\)", which works as expected for the path "..\..\a\b" where it will give me 2 successful groups ("..\"), but when I try the path "..\a\b" it will also return 2 when it should return 1. I tried this i...
Hi I've been working on a regular expression to parse the output of a series of SQLIO runs. I've gotten pretty far, but not quite there yet. I'm seeking a 100% regex solution and no pre-manipulation of the input. Could anyone assist with a little guidance with the following regular expression: .*v(?<SQLIOVersion>\d\.\d).*\n.*\n(?<thr...
Is it possible to use a regular expression with the php function array_key_exists()? For example: $exp = "my regex"; array_key_exists($exp, $array); Thank you! ...
I have text that looks like: My name is (Richard) and I cannot do [whatever (Jack) can't do] and (Robert) is the same way [unlike (Betty)] thanks (Jill) The goal is to search using a regular expression to find all parenthesized names that occur anywhere in the text BUT in-between any brackets. So in the text above, the resul...
i search for a regex to split the following string: aaa[bbb,ccc[ddd,{eee:1,mmm:999}],nnn[0,3]] aaa[bbb,ccc[ddd,{eee:1, mmm:[123,555]}],nnn[0,3]] aaa[bbb, ccc[ddd, ddd],nnn[0,3]] aaa[bbb,ddd[0,3]] by '[' or ']' or ',' unless the ',' is in '{}'. As example: split 'aaa[bbb,ccc[ddd,' to aaa, bbb, ccc, ddd is allow but not {eee:1,mmm:999}....
I need a regex to run against strings like the one below that will convert absolute paths to relative paths under certain conditions. <p>This website is <strong>really great</strong> and people love it <img alt="" src="http://localhost:1379/Content/js/fckeditor/editor/images/smiley/msn/teeth_smile.gif" /></p> Rules: If the url conta...
I know the right way to do this if I have Perl 5.10 is to use named captures and values %+, but in Perl 5.8.9 and how can I get a list of successful captures? I have come up with two methods that are both just terrible: #you need to list each possible match my @captures = grep { defined } ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, ...
Hello again Stackoverflow people! Assume I have these words: smartphones, smartphone I want to match the substring "phone" from within them. However, in both case, I want only "phone" to be returned, not "phones" in the first case. In addition to this, I want matches only if the word "phone" is a suffix only, such that: fonephonetics ...
I am trying to cleanup a string coming from a search box on a multi-language site. Normally I would use a regex like: $allowed = "-+?!,.;:\w\s"; $txt_search = preg_replace("/[^" . $allowed . "]?(.*?)[^" . $allowed . "]?/iu", "$1", $_GET['txt_search']); and that works fine for English texts. However, now I need to do the same when th...