I am taking create statement queries from SQLite like this:
CREATE TABLE [users] ([id] INTEGER PRIMARY KEY AUTOINCREMENT, [username] VARCHAR, [password] VARCHAR, [default_project] VARCHAR)
created by using
SELECT sql FROM sqlite_master WHERE type = 'table' AND name = :table
and determining the autoincrement field with a regular ex...
I'm very bad with regular expressions and cannot find how to write the pattern I'm looking for. I'm trying to parse the output from Visual Studio looking for errors. I'd like to exclude things like...
5>projname - 0 error(s), 0 warning(s)
but grab lines like
6>codeFile.cpp(1282): error: 'TEST_ITEM' was not declared in this scope
I ...
I gave up on sed and I've heard it is better in Perl.
I would like a script that can be called from the 'unix' command line and converts DOS line endings CRLF from the input file and replaces them with commas in the output file:
like
myconvert infile > outfile
where infile was:
1
2
3
and would result in outfile:
1,2,3
I would...
I am looking for a regex expression to validate the input which should contains at least three of the following four characters group:
English uppercase characters (A through Z)
English lowercase characters (a through z)
Numerals (0 through 9)
Non-alphabetic characters (such as !, $, #, %)
Thanks in advance.
Edit: This is for .NET Fr...
I'm staring blank on this error, so I hope someone here can point out where I go wrong.
This function should replace a parameter's value in a querystring with a new value:
function ReplaceParameter(querystring, key, value) {
var myregexp = new RegExp("(?<="+key+"=).+(?=&)", "i");
return querystring.replace(myregexp, value);
}
...
I have a URL as a string. How do I match the numbers after the VideoID. Also VideoID may occur at different points in the URL. But I will worry about that afterwards, as I can't even do this.
$string = 'http://example.com/index.php?action=vids.individual&VideoID=60085484';
preg_match('/(?<VideoID>)=/', $string, $matches);
print_r(...
Problem:
^.+ matches only the first line of the source code in dreamweaver. I need it to match each line so that I can wrap each full line in P tags. I have 500 files to do this in.
I know ^ should match the beginning of a line and I also know that multi-line mode must be enabled for it to work on each line and not just at the beginnin...
I have a simple grep command that returns lines that match from a file. Here's the problem: Sometimes, when a line matches, I want to include the line before it. What I want is a way to find all the lines that match a pattern, then use a different pattern to see if the line before each of those results match.
Let's say I want to get ...
I'd like to use mod_rewrite to handle my requests of avatar images.
I've got a folder containing all .png images and the file is named after the account's username.
So I would like requests for /avatar/Juddling, to show the image, /images/avatars/Juddling.png BUT if that file doesn't exist, I would like it to show a default.png image.
...
Try as I might, I can't get a RegEx to exclude space or single quotes.
The string "abc" is allowed
Not allowed: "a'bc", "'", "'abc", "'''", "abc''" etc
Spaces could replace the ' too in the above example
Trailing and leading spaces are assumed to be removed already
Empty strings are checked elsewhere
Target language is javascript
I'd...
Let's say we have two regular expressions:
1234.*
and
.*
Input:
1234567
Obviously they both match, but 1234.* matches better since it is more specific. i.e. is more relevant. Is there a standard way for checking which is more relevant?
edit:
Some clarification. I want to make decisions by checking which regexp matches the inpu...
I am trying to create a validation that checks to make sure a domain/url is valid for example "test.com"
def valid_domain_name?
domain_name = domain.split(".")
name = /(?:[A-Z0-9\-])+/.match(domain_name[0]).nil?
tld = /(?:[A-Z]{2}|aero|ag|asia|at|be|biz|ca|cc|cn|com|de|edu|eu|fm|gov|gs|jobs|jp|in|info|me|mil|mobi|museum|ms|name|ne...
How do I find all CamelCased words in a document with a regular expression? I'm only concerned with Upper camel case (i.e., camel cased words in which the first letter is capitalized).
...
I'd like to use a number with a decimal point in a Django URL pattern but I'm not sure whether it's actually possible (I'm not a regex expert).
Here's what I want to use for URLs:
/item/value/0.01
/item/value/0.05
Those URLs would show items valued at $0.01 or $0.05. Sure, I could take the easy way out and pass the value in cents so...
Suppose I have a string like this:
string = "Manoj Kumar Kashyap";
Now I want to create a regular expression to match where Ka appears after space and also want to get index of matching characters.
I am using java language.
...
I want to match just the folder name that a file is in,
eg:
pic/2009/cat01.jpg
pic/2009/01/cat02.jpg
I want to just match what I put in bold.
So far I have this:
[^/]*/
Which will match,
pic/2009/cat01.jpg
Any idea?
...
I want to pull a number out the middle of a string in JavaScript. In Ruby (my main language) I would do this:
Ruby:
name = "users[107][teacher_type]"
num = name.scan(/\d+/).first
But in JavaScript I have to do this, which seems a bit clunky.
JavaScript:
var name = "users[107][teacher_type]"
var regexp = new RegExp(/\d+/)
var num...
Hi all ..
I'm quite new to Regex'es, so I was wondering if this is possible?
Take a string and check that all characters are A-Z or a-z.
My best guess so far is:
"^[A-Za-z]*$"
But it seems to have some trouble if a character in the middle of the string is not a valid character (fx. "aaa__aa"). The Regex.IsMatch returns true.. :(
[...
I am working on this bit of code that checks a line of actionscript 3 code for the existance of a type (MovieClip, Sprite, along with the custom classes defined in the classpath) that is in a collection that is being iterated.
for (String type: typeList) {
if (input.contains(type)) {
// dome something here
}
}
The prob...
I would like to check a URL to see if it contains one of multiple strings, and then based on that, send it to a different URL. Am I forced to use multiple lines, one for each possibility? Or is there anyway to form an if statement? I figured that something like this should work:
(string1)(string2)(string3) example.com/$1$2$3
because in...