removing special codes using asp and RegExp
Hi im just wondering if anyone knows how to remove special codes and spaces from a string in asp classic ? thanks ...
Hi im just wondering if anyone knows how to remove special codes and spaces from a string in asp classic ? thanks ...
From my research it looks like Javascript's regular expressions don't have any built-in equivalent to Perl's /x modifier, or .NET's RegexOptions.IgnorePatternWhitespace modifier. These are very useful as they can make a complex regex much easier to read. Firstly, have I missed something and is there a Javascript built-in equivalent to ...
I need a regular expression for checking a string, that it has more than 2 symbols length, first symbol should be Alphabetic, last symbol should be '_'. And how can I uppercase only first symbol? Thank you. ...
Is it possible to write a regular expression that matches all strings that does not only contain numbers? If we have these strings: abc a4c 4bc ab4 123 It should match the four first, but not the last one. I have tried fiddling around in RegexBuddy with lookaheads and stuff, but I can't seem to figure it out. ...
Hello. I would like to replace strings that starts with "[id", has a middle part unknown and ends in "]" in a $text. I know how to replace strings that starts with "[id" and ends with "]" but I can't figure out how to include the unknown middle body part as a rule of replace. Any ideas how to replace like this ? Thanks. ...
I know this regex divides a text into sentences. Can someone help me understand how? /(?<!\..)([\?\!\.])\s(?!.\.)/ ...
Hi, I have the HTML in the form of a string and before I display it in the browser, I want to change all the relative urls on the page to absolute urls. How can I do it the best way? I was thinking of Regex as an option to get the href attributes of anchor tags and append the base url to it, but not sure how to do it? Can someone help or...
How do I make the following regular expression accept only the symbols I want it to accept as well as spaces? if(!preg_match('/^[A-Z0-9\/\'&,.-]*$/', $line)) { die(); } else { //execute the rest of the validation script } I want the user to only be able to enter A-Z, 0-9, forward slashes, apostrophes, ampersands, commas, perio...
I've got a working regular expression, but I'd like to make it a tad more readable, and I'm far from a regex guru, so I was humbly hoping for some tips. This is designed to scrape the output of several different compilers, linkers, and other build tools, and is used to build a nice little summery report. It does it's job great, but I'm...
I'm seeking simple Python function that takes a string and returns a similar one but with all non-ascii characters converted to their closest ascii equivalent. For example, diacritics and whatnot should be dropped. I'm imagining there must be a pretty canonical way to do this and there are plenty of related stackoverflow questions but I'...
I have a Korn shell script that I would like to change a variable based on another and a regex. What I want to happen is to generate a variable value like below, but without calling sed: $ echo 'orl,bdl,lap' | sed "s/,*orl//" | sed "s/^,*//" bdl,lap $ echo 'orl,bdl,lap' | sed "s/,*bdl//" | sed "s/^,*//" orl,lap $ echo 'or...
I have the following data Animals = Dog Cat Turtle \ Mouse Parrot \ Snake I would like the regex to construct a match of just the animals with none of the backslashes: Dog Cat Turtle Mouse Parrot Snake I've got a regex, but need some help finishing it off. /ANIMALS\s*=\s*([^\\\n]*)/ ...
Hi everyone, Here's my code $string = preg_replace("/rad\:([0-9]+)px\;\s+\/\*\sALT\[(.+)\*\/|rad\:([0-9]+)px\;/",("$2"?"$2":"$1"),$string); Basically, in the regex I've got a pipe |, and I'm searching for two patterns. If there is a match to the first pattern (to the left of the pipe), then I want the it to be replaced with the seco...
Hi, I can't seem to figure out captures + groups in Regex (.net). Let's say I have the following input string, where each letter is actually a placeholder for more complex regex expression (so simple character exclusion won't work): CBDAEDBCEFBCD Or, more generically, here is a string pattern written in 'regex': (C|B|D)*A(E*)(D|B|C...
Hello everyone, I am trying to match a date in PHP using preg_match, split it and assign parts of it to an array, the date looks like "20100930", here is the code I am using: // Make the tor_from date look nicer $nice_from = $_POST['tor_from']; $matches = array(); $ideal_from = ''; preg_match('/\d{4}\\d{2}\\d{2}\/', $nice_from, $matc...
I have a regular expression that runs through html tags and grabs values. I currently have this to grab all values within the tag. <title\b[^>]*>(.*\s?)</title> It works perfectly. So if I have a bunch of pages that have titles: <title>Index</title> <title>Artwork</title> <title>Theory</title> The values returned are: Index, Ar...
What is a regular expression that can be used to validate a CSS selector, and can do so in a way that a invalid selector halts quickly. Valid selectors: EE #myid .class .class.anotherclass EE .class EE .class EEE.anotherclass EE[class="test"] .class[alt~="test"] #myid[alt="test"] EE:hover EE:first-child E[lang|="en"]:first-child EE#tes...
Suppose I have a string like "abc | xyz" and I'd like to turn it into "xyz | abc" using only a regular expression substitution. (For this example there may be better ways, but this is a stand-in for something hairier.) The following code doesn't do what I expect: x = "abc | xyz" x = x.gsub(/^([^\|\s]*)\s*\|\s*(\S*)/, "\2 | \1") puts x...
I have a shared hosting plan with HostGator and multiple CI installations. For each installation, I've been able to successfully remove the "index.php" from the URL, but on my addon domain, none of my CSS, or JS, or image files load correctly. Here is what I have for mod rewrite on the main domain: RewriteEngine on RewriteCond $1 !^(i...
How do I specify a range of unicode characters from ' ' (space) to \u00D7FF? I have a regular expression like r'[\u0020-\u00D7FF]' and it won't compile saying that it's a bad range. I am new to Unicode regular expressions so I haven't had this problem before. Is there a way to make this compile or a regular expression that I'm forgett...