Hello, I have to parse this template file ($html) :
{$myFirstVariable}
{$myMainVar:MYF1,"x\:x\,x",2:MYF2:MYF3,false}
{$myLastVariable:trim}
Following, my php parser :
$regexp = '#{\$(?<name>.+?)(\:(?<modifiers>.+?))?}#';
preg_replace_callback($regexp, 'separateVariable', $html);
function separateVariable($matches) {
$varname = ...
Hello,
I thought this was trivial but couldn't solve it out :(
I want to change a param passed in mu url with javascript.
var fullurl = window.location;
//do dome stuff to find var url.
fullurl.replace(/sort:.*\/direction:.*/g,'sort:' + url + '/direction:asc');
Basically there is a url like: http://example.com/article/ or http://exam...
Hi,
I search the internet but I couldn't find a proper answer so I try this way.
I use this code to validate UTF-8 input. I want to allow printable chars and some specified special chars.
$pattern = '/[^\w\.\-\s\,\&\!\?\(\)\+\_\:\;]+$/u';
$status = @preg_match($pattern, $value);
if (($status === false) || ($status > 0)) {
return f...
Same for example I have this:
Hello world!!
Hello all!
I want replace each "!" with a period for example. With PHP. How would I do that?
...
I'm working on a piece of code that uses regex expressions to do a find/replace for emoticons in a chat. However, I want to use the same array of values and output them as a reference.
The regex works fine for my searches, but when I tried to do a replace on the regex search string before I output it for my help, I still end up with a s...
I have a pattern match here that looks like it should work fine. However any input I give makes the conditional fail. I will handle the '99999-9999' case after I get the '99999' case working.
$ZipCode is a textfield that is being submitted on POST.
$ZipCode = $_POST["ZipCode"];
if(!preg_match("/^[0-9]{5}$/", $Z...
I'm trying to make something that parses text for possible addresses and turns them into Google Maps links. Is there any reference for the most general address format that Google Maps will accept as a query? Seems like something they'd want to make public, but I can't find anything in the docs.
...
For example, /(\w+) (?:\+) (\w)/
that regexp must return 2.
I must apologize for an incomplete question. Here's the problem: Input is XML-file (in fact it does not matter :), which sets rules for strings. At the moment it looks like this:
<string svars="3">(?:total ?|)(\d{1,2}(?:[\.,]\d{1,2}|))\/(\d{1,2}(?:[\.,]\d{1,2}|))\/(\d{1,2}(?:...
Hi,
I would like to specify the regular expression during run-time, not compile-time.
So that is why pcre falls out.
Do you know C/c++ regular expression library that can parse streams and can recognise relatively complex regular expression such as .+?
Thanks.
...
I want to ignore .pyc files in the Netbeans project browser.
I think I found a way: TOOLS -> MISCELLANEOUS -> FILES .
Here is a section called: Files ignored by the IDE .
The field there is waiting for a regex describing the file pattern . The default value for that field is:
^(CVS|SCCS|vssver.?\.scc|#.*#|%.*%|_svn)$|~$|^\.(?!htacces...
I'm trying to figure out the reason behind some regex comparison results I'm getting in Vim. I'm trying to match strings that begin line with one or more asterisks. Here's how various regex's match the strings:
echo '* text is here' =~ '\^*\*\s' prints 1 (i.e., MATCH)
echo '* text is here' =~ '^*\*\s' prints 0 (NO MATCH)
echo '** t...
Does anyone know the rules for valid Ruby variable names? Can it be matched using a RegEx?
UPDATE: This is what I could come up with so far:
^[_a-z][a-zA-Z0-9_]+$
Does this seem right?
...
Hi, i am trying to capture the text in the inverted commas in the following string using c# regular expresions.
I've tried a whole lot of patterns but none of them are matching..
Can anyone help?
text1.text2 = text3["THISISWHATIWANTTOCAPTURE"].text4();
...
This is what I'm doing
a = "%span.rockets#diamonds.ribbons.forever"
a = a.match(/(^\%\w+)([\.|\#]\w+)+/)
puts a.inspect
This is what I get
#<MatchData "%span.rockets#diamonds.ribbons.forever" 1:"%span" 2:".forever">
This is what I want
#<MatchData "%span.rockets#diamonds.ribbons.forever" 1:"%span" 2:".rockets" 3:".#diamonds" 4:".r...
Silly question, but I do not know how to find (2000) into a regular expression and replace it with [2000]
...
Hi,
I want to enable this kind of routing in my site where users can create their vanity urls
test.com/[user-url]
but also dont want to ruin the routing for my existing controllers
test.com/users
test.com/business
test.com/admin
so I added this to my routes.php
Router::connect('/*', array('controller' => 'business', 'action' => 'view...
I have a log file, most lines are quoted at first and last character, like:
"2010-09-09,13:33,"user logoff",0"
What's the ruby regex to remove the head and tail quotation marks? so the result string looks like:
2010-09-09,13:33,"user logoff",0
...
Hi,
i must convert a string (user generated) to a regex rule.
My problem is that i must say,
replace every sign but not
a-b, 0-9, minus, dot and comma
I hope somebody can help.
HTML
<div id="d1" class="line1"></div>
JS
$(function() {
new_regex_rule = 'hello,bl.com,dkd-dkd.com,blub,blib,satssan kommt';
// new_regex_rule...
Hi need to change the function ereg_replace("[\]", "", $theData) to preg_replace
...
How to put a validation over a field which wouldn't allow only special characters, that means AB#,A89@,@#ASD is allowed but @#$^& or # is not allowed.I need the RegEx for this validation.
...