Hi,
I asked a question about regular expression in PHP (which got answered), I need help with same regular expression in javascript, here is the link to previous question. http://stackoverflow.com/questions/2015320/need-help-with-writing-regular-expression
Again I am not looking to get JSON.parse and get the json object, I need to fin...
Background: I have a site that displays songs with the Post structure of .com/song/foo.html
I am adding every song to an additional child category called "private" that uses a different template (inserts premium content in custom fields), so the structure of the private versions of the Posts will be .com/song/private/foo.html.
Question...
I recently tried to import a bunch of blog posts from an old blog (SharePoint) to my current blog (WordPress). When the import completed, a lot of nasty <div> tags and other HTML made it in to the content of the post, which screwed up the way my site was rendering.
I'm able to view the offending rows in the MySQL database and want to k...
What is the preferred way to extract elements from a HTML page in Java?
My HTML is has many of the following rows:
<tr class="item-odd">
<td class="data"><a href="http://.....">TITLE</a></td>
<td><div class="cost">$1.99</div></td>
</tr>
The class alternates item-odd and item-even.
I need to extract:
Ur...
UPDATE: I'm making progress, but this is hard!
The test text will be valid[REGEX_EMAIL|REGEX_PASSWORD|REGEX_TEST].
(The real life text is required|valid[REGEX_EMAIL]|confirmed[emailconfirmation]|correct[not in|emailconfirmation|email confirmation].)
([^|]+) saves REGEX_EMAIL, REGEX_PASSWORD and REGEX_TEST in an array.
^[^[]+\[ matche...
Hello all,
I am looping through a list of files in a directory and I want to match a substring that I have with the filename. If the filename contains the substring then return that file name so that I can delete it. I have done the following and its just returning everything:
while ($file = readdir($dir_handle)) {
$extension...
I can't seem to figure out the regex pattern for matching strings only if it doesn't contain whitespace. For example
"this has whitespace".match(/some_pattern/)
should return nil but
"nowhitespace".match(/some_pattern/)
should return the MatchData with the entire string. Can anyone suggest a solution for the above?
...
Is there a way to dynamically update the name of regex groups in Python?
For example, if the text is:
person 1: name1
person 2: name2
person 3: name3
...
person N: nameN
How would you name groups 'person1', 'person2', 'person3', ..., and 'personN' without knowing beforehand how many people there are?
...
<div class="begin">...</div>
How to match the html inside(including) <div class="begin"> in PHP?
I need a regex solution that can handle nested case.
...
I wrote a Regular Expression that generates a url like
/abc/deutschland/bbs-tagesfahrten/betz-mode-frotier-center-–-tress-teigwaren.html.
Now I want to replace the repeating dashes with the single on. How Can I?
...
I am trying to create a simple alert app for some friends.
Basically i want to be able to extract data "price" and "stock availability" from a webpage like the folowing two:
http://www.sparkfun.com/commerce/product_info.php?products_id=5
http://www.sparkfun.com/commerce/product_info.php?products_id=9279
I have made the alert ...
I have a JavaScript string containing HTML like this:
<div>
<div class="a">
content1
</div>
content 2
<div class="a">
<b>content 3</b>
</div>
</div>
and I want to remove the div's of class="a" but leave their content.
In Python I would use something like:
re.compile('<div class="a">(.*?)</div>', re.DOTALL).sub(r'\1', html)
...
var string = 'abcd+1';
var pattern = 'd+1'
var reg = new RegExp(pattern,'');
alert(string.search(reg));
I found out last night that if you try and find a plus sign in a string of text with a javascript regular expression, it fails. It will not find that pattern, even though to me it looks pretty clear that is exists. This has to be b...
Trying to parse this and return the following 3 items:
-30.25 31.46 -27.46 31.74
-24.57 32.03 -16.86 32.88
-13.82 33.19 -9.69 33.62
Using this regex expression below I get the matches, but drop the leading "-" at the front of each grouping. I get the "-" in the middle of the group though. Here is the expression I currently use.
Di...
I'm trying to to a trim to some values using replaceregexp. Everything looks great when I try it in software like EditPad Pro.
Here's a sample of what I want to accomplish:
mf.version.impl = 2.01.00
mf.version.spec= 2.01.00
Notice the extra spaces after the last digit.
Then I'm using this pattern:
[0-9]+.[0-9]+.[0-9]+[ ]*
But...
I have about 20 domains in my htaccess file but the domains are still getting through. Can someone please tell me what I am doing wrong?
RewriteCond %{HTTP_REFERER} 78safd\.net [NC]
RewriteRule .* - [F]
...
How do I do the following conversion in regex in Perl?
British style US style
"2009-27-02" => "2009-02-27"
I am new to Perl and don't know much about regex, all I can think of is to extract different parts of the "-" then re-concatenate the string, since I need to do the conversion on the fly, I felt my approach will be pretty slow ...
I know that in normal php regex (ASCII mode) "\w" (word) means "letter, number, and _". But what does it mean when you are using multibyte regex with the "u" modifier?
preg_replace('/\W/u', '', $string);
...
What does
/.*=/,''
mean in
var id=this.href.replace(/.*=/,'');
?
Full code
function delete_subscriber(){
var id=this.href.replace(/.*=/,'');
this.id='delete_link_'+id;
if(confirm('Are you sure you want to delete this subscriber?'))
$.getJSON('delete.php?ajax=true&id='+id, remove_row);
return false;
}
I assume it is regex, bu...
I want to compare an URI String over different patterns in java and I want fastest code possible.
Should I use :
if(uri.contains("/br/fab") || uri.contains("/br/err") || uri.contains("/br/sts")
Or something like :
if(uri.matches(".*/br/(fab|err|sts).*"))
Note that I can have a lot more uri and this method is called very often.
W...