I am working on improving our glossary functionality in a custom CMS that is running with classic ASP (ASP 3.0) on IIS with VBScript code. I am stumped on a regex challenge I cannot solve.
Here is the current code:
If InStr(ART_ArticleBody, "href") = False then
sql="SELECT URL, Term, RegX FROM GLOSSARYDB;"
Set rsGlossary = S...
If I have a string $random, and I want to throw out everything except commas and numbers, how could I do this in PHP PCRE?
I know \d will match numbers, but I don't get the rest of PCRE.
...
hi there,
I'm looking to do do two things and i am looking to do them in a beautiful way. I am working on a project that allows users to upload flickr photos by simply entering their flickr image URL. It looks like this:
http://www.flickr.com/photos/xdjio/226228060/
i need to:
make sure it is a URL that matches the following format:
...
hi all
I have a string with a number inside and I want to retrieve that number.
for example if I have a string "bla bla 45 bla bla" I want to get the number 45.
I have searched a bit and found out that this code should make the work
Matcher matcher = Pattern.compile("\\d+").matcher("bla bla 45 bla bla");
if(matcher.matches())
String...
I would like to use a regular expression to extract "bind variable" parameters from a string that contains a SQL statement. In Oracle, the parameters are prefixed with a colon.
For example, like this:
SELECT * FROM employee WHERE name = :variable1 OR empno = :variable2
Can I use a regular expression to extract "variable1" and "variab...
I've got the following string :
const std::string args = "cmdLine=\"-d ..\\data\\configFile.cfg\" rootDir=\"C:\\abc\\def\""; // please note the space after -d
I'd like to split it into 2 substrings :
std::str1 = "cmdLine=...";
and
std::str2 = "rootDir=...";
using boost/algorithm/string.hpp . I figured, regular expressions would ...
I have a schema like this
<h1>
5/2009
<br/>
Question: This is the question
</h1>
I like to get the first part after the <br/> or always the string before the colon :
--> Solution should be "Question"
Attention: This words change - Sometimes its question, othertime may be big question ....
I tried with <h1>(.{0,50}):(.{0,50}) but t...
Hi,
I some text with HTML artifacts where the < and > of tags got dropped, so now I need something that will match a small p followed by a capital letter, like
pThe next day they....
And I also need something that will catch the trailing /p which is easier. These need to be stripped, i.e. replaced with "" in python.
What RE would I ...
What is the regex to make sure that a given string contains at least one character from each of the following categories.
Lowercase character
Uppercase character
Digit
Symbol
I know the patterns for individual sets namely [a-z], [A-Z], \d and _|[^\w] (I got them correct, didn't I?).
But how do I combine them to make sure that the...
Hi,
The regular expression ^(((\d{3}) ?)|(\d{3}-))?\d{3}-\d{4}$
matches strings of the form XXX-XXX-XXXX and XXX-XXXX (am I missing out something?)
It doesn't, however, match (XXX) XXX-XXXX and (XXX) XXX-XXX-XXXX as well (which I need it to match).
Can you help me fix it so that it matches the formats
XXX-XXX-XXXX,
XXX-XXXX,
(XXX) ...
I have an application that uses the following Regex to validate UK post Codes.
(GIR 0AA)|((([A-Z-[QVX]][0-9][0-9]?)|(([A-Z-[QVX]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVX]][0-9][A-HJKSTUW])|([A-Z-[QVX]][A-Z-[IJZ]][0-9][ABEHMNPRVWXY])))) [0-9][A-Z-[CIKMOV]]{2})
If I understand this regex correctly Post codes allowed should be either this post...
I am developing an application and I would like to be able to search the whole drive for a regular expression. I would prefer to do this in c# but I can call other languages. Is there any easy way to just seek through all the binary data on a drive from begining to end?
...
Hi all,
i need an regex to do the following:
redirect EVERY request to the index.php
if there are get parameters in the url i need to access them with $_GET[] (php)
My (not complete) solution is:
url.rewrite-once = (
".*\?(.*)$" => "/index.php?$1&full_request=$0"
)
But the error here is that if there's not an "?" in the url i g...
So I am trying to figure out a Regular Expression and am having some issues. What I want to find (match) is all of the SQL parameters in a large script file, but NOT match items in single quotes (such as email addresses). For example:
INSERT INTO [User]
(
[UserGuid], [CompanyGuid], [Name], [EmailAddress]
) VALUES (
@UserGuid1, @C...
I'm using regular expressions to try to match section blocks in an INI file. I'm using the recipe given in the book Regular Expressions Cookbook, but it doesn't seem to be working for me.
Here is the code I'm using:
final BufferedReader in = new BufferedReader(
new FileReader(file));
String s;
String s2 = "";
while((s = in.readLin...
Using PHP, how can I verify if a phone # is well formed?
It seems easiest to simply strip all non-numeric data, leaving only the numbers. Then to check if 10 digits exist.
Is this the best and easiest way?
...
Hey all
I'm trying to create a regular expressions that will filter valid emails using PHP and have ran into an issue that conflicts with what I understand of regular expressions. Here is the code that I am using.
if (!preg_match('/^[-a-zA-Z0-9_.]+@[-a-zA-Z0-9]+.[a-zA-Z]{2,4}$/', $string)) {
return $false;
}
Now from the materials th...
Well, I tried and failed so, here I am again.
I need to match my abs path pattern.
/public_html/mystuff/10000001/001/10/01.cnt
I am in taint mode etc..
#!/usr/bin/perl -Tw
use CGI::Carp qw(fatalsToBrowser);
use strict;
use warnings;
$ENV{PATH} = "bin:/usr/bin";
delete ($ENV{qw(IFS CDPATH BASH_ENV ENV)});
I need to open the same...
Hi,
Just can't figure aout those regular expressions.
I have an .htaccess file with some url rewrites. Look below what I have now:
RewriteRule ^news news/ [R]
RewriteRule ^news/([-A-z0-9]+)/$ news/$1 [R]
RewriteRule ^news/([-A-z0-9]+)$ index.php?news=$1 [L]
I don't think this is correct, I mean I think it could be better.
This is w...
I am working on a project for my computer security class and I have a couple questions. I had an idea to write a program that would search the whole hard drive looking for email addresses. I am just looking for addresses stored in plain text since it would be hard to find anything otherwise. I figured the best way to find addresses would...