regex

Replace quotes in xml string

Hello, I have a problem with double quotes in classic ASP. I want to replace double quotes " in a string. The string contains xml and I don't want to replace double quotes (for attributes) inside tags. So if I wanted to replace double quotes with single quotes, I'd want my string to go from this: <MyDinosaurDocument DocType="Brachy...

Regex Rewrite Filename

Having trouble rewriting the name of a flash file: /flash/shell.1257347618.swf (the numbers are a changing timestamp, the idea is to bypass browser caching). My .htaccess looks like this: #Use mod.rewrite RewriteEngine On #Cache files which are autoversioned ExpiresActive On <FilesMatch "\.(swf)$"> ExpiresDefault "access plus 10 ...

Regex Help Simple Pattern

I am very weak with Regex and need help. Input looks like the following: <span> 10/28 &nbsp;&nbsp;Currency:&nbsp;USD Desired output is 10/28. I need to get all text between the <span> and "Currency:" that are numbers, a "/" character, or a ":" character. No spaces. Can you help? Thanks. ...

To split only Chinese characters in java

I am writing a java application; but stuck on this point. Basically I have a string of Chinese characters with ALSO some possible Latin chars or numbers, lets say: 查詢促進民間參與公共建設法(210BOT法). I want to split those Chinese chars except the Latin or numbers as "BOT" above. So, at the end I will have this kind of list: [ 查, 詢, 促, 進, 民, 間, ...

Mod rewrite question (really a regex problem)

Ive started out with the most basic rewrite there is, take any request and give it to my index page: RewriteEngine On RewriteRule ^.*$ index.php [L,QSA] Im trying to change it now so lets say i have a directory called special, I actually want to be able to go to http://example.com/special and access whatever files are in there. I tri...

Capture content inside html tags with regex

First off, I'm aware this is a bad practice and I have answered many questions even saying so, but to clarify I am forced to use regex because this application stores regexes in a database and only functions this way. I absolutely cannot change the functionality Now that we got that out of the way.. because I always use DOM methods I'm ...

Manipulating Javascript's parenthesized substring matches

Example taken from Mozilla's help page <script type="text/javascript"> re = /(\w+)\s(\w+)/; str = "John Smith"; newstr = str.replace(re, "$2, $1"); document.write(newstr); </script> Is it possible to further manipulate the substring match directly in any way? Is there any way to, for example, capitalize just the word Smith in ...

split select statement with regular expression

hello, i need to split any mysql select statement in its main parts: SELECT, FROM, ALL THE JOINS(if there are any), WHERE(if it exists),GROUP BY(if it exists), HAVING(if it exists), ORDER BY(if it exists), LIMIT(if it exists)... i tried using regular expressions, but i'm not very good with them... for the SELECT the regex was simple (an...

label wont add to Panel control at runtime (but i dont get any errors)

well, the title pretty much says it all. here's a little info: i have a text file, and inside that textfile contains: Label "this text will be associated with the Text property of the label once the label has been added to the Panel Control at runtime." 20, 45 Trebuchet MS 14.0 explanation of the above the above file may have only on...

How can I accept mail from only one domain in smtp-gated?

I need a Perl-compatible regular expression for filtering my email with smtp-gated. I only want to allow one domain ('mydomain.com') and reject everything else. How do I do this in a foolproof way? (regex_reject_mail_from) I know this question halfway belongs on serverfault, but basically it's a Perl regex question so I think it fits st...

How to validate an IP address with regular expression in objective C

How to validate an IP address in objective C. ...

Conforming a Regex that matches the following patterns?

I have the following patterns in a URL. John.Smith John.Smith.1 John.Al-Smith John.al-smith.1 John.Smith.Al-Caboon Where the first (.) is mandatory and with at least one character before and after the first (.), the rest of the stuff (the numbers, hyphen, and the second (.)) are optional. I created the following Regex: ^\w+.\w+-...

How to match {1,0} with regular expression?

? or `{0,1}` will match some pattern when necessary,but now I want to do it reversely. Say,don't match if necessary. Anyone get what I mean has the solution? ...

Regex to replace ampersands, but not when they're in a URL

So I have this regex: &(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);) That matches all &'s in a block of text However, if I have this string: & & & & & <a href="http://localhost/MyFile.aspx?mything=2&amp;this=4"&gt;My Text &</a> ---------------------------------------------------------^ ... the marked & also get's targeted - and as I'm using i...

Regular Expression with quotes in javascript

i like to check this email address with javascript and regex. Beacuse of quotes and other signs.. there will be syntax error. i checked with firebug. now, can anyone send me a possible solution to check this with javascript. (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*| "(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5...

preg_replace problem

Hi, I'd like to match and extract variables from: {{variable:int}} variable would be anything a-z : is a separator int would be an integer 0-9 Curretly i have: preg_replace('!\{\{(\S+)\}\}!', "$1", $string) which does only half the job, i still have to split by :. Thank you! ...

Reverse a word in Vim

How can I reverse a word in Vim? Preferably with a regex or normal-mode commands, but other methods are welcome too: word => drow Thanks for your help! PS: I'm in windows XP Python is built in supported in my vim, but not Perl. ...

Javascript regex

Hi all, Currently I have a basic regex in javascript for replacing all whitespace in a string with a semi colon. Some of the characters within the string contain quotes. Ideally I would like to replace white space with a semi colon with the exception of whitespace within quotes. var stringin = "\"james johnson\" joe \"wendy john...

Is UIWebView's JavaScript evaluator able to use the JS's RegExp object?

There is no default RegEx library on the iPhone. Is it ok if I use UIWebView's stringByEvaluatingJavaScriptFromString to evaluate a JavaScript string that actually uses the RegExp object to evaluate an expression? Is this supported on the iPhone? ...

PHP preg_match problem

Hi guys i'm having a problem, I have the following code: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="320" height="240"> <param name="movie" value="http://www.domain.com" /> <param name="quality" value="high" /> <param...