I have a pattern to match with the string:
string pattern = @"asc"
I am checking the SQL SELECT query for right syntax, semantics, ...
I need to say that in the end of the query string I can have "asc" or "desc".
How can it be written in C#?
...
I`m parsing SQL query with C# Regex.
I need also to make my pattern to understand "=", for example:
string pattern = @"...something...(where)\s\w*\s*(order by)*...something else...";
the following query should match my pattern:
select fieldslist from mytable where fieldvalue=someint order by specialfield
how can I change the interva...
I need to match a string like "one. two. three. four. five. six. seven. eight. nine. ten. eleven" into groups of four sentences. I need a regular expression to break the string into a group after every fourth period. Something like:
string regex = @"(.*.\s){4}";
System.Text.RegularExpressions.Regex exp = new System.Text.Regul...
Suppose I have the following two strings containing regular expressions. How do I coalesce them? More specifically, I want to have the two expressions as alternatives.
$a = '# /[a-z] #i';
$b = '/ Moo /x';
$c = preg_magic_coalesce('|', $a, $b);
// Desired result should be equivalent to:
// '/ \/[a-zA-Z] |Moo/'
Of course, doing this as ...
I have a series of text that contains mixed numbers (ie: a whole part and a fractional part). The problem is that the text is full of human-coded sloppiness:
The whole part may or may not exist (ex: "10")
The fractional part may or may not exist (ex: "1/3")
The two parts may be separated by spaces and/or a hyphens (ex: "10 1/3", "10-1/...
I have the following text
tooooooooooooon
According to this book I'm reading, when the ? follows after any quantifier, it becomes non greedy.
My regex to*?n is still returning tooooooooooooon.
It should return ton shouldn't it?
Any idea why?
...
I am trying to match the folder name in a relative path using C#. I am using the expression: "/(.*)?/" and reversing the matching from left to right to right to left.
When I pass "images/gringo/" into the regular expression, it correctly gives me "gringo" in the first group - I'm only interested in what is between the brackets.
When I pa...
Hey Folks!
Looking for a bit of regex help.
Id like to design an expression that matches a string with "foo" OR "bar" but not both "foo" AND "bar"
If I do something like...
/((foo)|(bar))/
Itll match "foobar". Not what Im looking for. So, how can I make regex match only when one term or the other is present?
Thanks!
...
I found a great web app for testing regexes as-you-type, but have lost it in the months since I last use it. Searching through here, I've found http://www.rubular.com/ which is useful, but not what I found originally. Today, I found a few testing tools through google, but most often they are slow, don't allow you to test as-you-type, or ...
How to get substring " It's big \"problem " using a regexp
s = ' function(){ return " Is big \"problem "; }';
...
Maybe I'm overlooking something in the Python re library but how can I get the start and end positions of for all matches of my pattern matches in a string?
For example for pattern r'[a-z]' on string 'a1b2c3d4' I'd want to get the positions where it finds each letter. (ideally I'd like to get the text of the match back too).
Any ideas...
I'm looking for a good JavaScript RegEx to convert names to proper cases. For example:
John SMITH = John Smith
Mary O'SMITH = Mary O'Smith
E.t MCHYPHEN-SMITH = E.T McHyphen-Smith
John Middlename SMITH = John Middlename SMITH
Well you get the idea.
Anyone come up with a comprehensive solution?
...
I'm trying to write a log parsing script to extract failed events. I can pull these with grep:
$ grep -A5 "FAILED" log.txt
2008-08-19 17:50:07 [7052] [14] DEBUG: data: 3a 46 41 49 4c 45 44 20 20 65 72 72 3a 30 32 33 :FAILED err:023
2008-08-19 17:50:07 [7052] [14] DEBUG: data: 20 74 65 78 74 3a 20 00 ...
Language: C#
Hello, I'm writing an application that uses renaming rules to rename a list of files based on information given by the user. The files may be inconsistently named to begin with, or the filenames may be consistent. The user selects a list of files, and inputs information about the files (for MP3s, they would be Artist, Tit...
Hi Folks,
I've got the following url route and i'm wanting to make sure that a segment of the route will only accept numbers. as such, i can provide some regex which checks the word.
/page/{currentPage}
so.. can someone give me a regex which matches when the word is a number (any int) greater than 0 (ie. 1 <-> int.max).
cheers!
...
This is a simple one. I want to replace a sub-string with another sub-string on client-side using Javascript.
Original string is 'original READ ONLY'
I want to replace the 'READ ONLY' with 'READ WRITE'
Any quick answer please? Possibly with a javascript code snippet...
...
Have you used the Perl 5.10 backtracking control verbs in your regexes yet? And what problems did they help you accomplish?
Just as background: I have done some fiddling, but I can't get any really useful results.
As a comparison, when I started getting what the (?> grouping did, it started showing up more in my regexes. I liked the...
I kind of wish that there were a version of re.findall that returned groupdicts instead of just groups. Am I missing some simple way to accomplish the same result? (Does anybody know of a reason that this function doesn't exist?)
...
Does anyone have any suggestions (or a regular expression) for parsing the HTTP Accept header?
I am trying to do some content-type negotiation in ASP.NET MVC. There doesn't seem to be a built in way (which is fine, because there are a lot of schools of thought here), but the parsing is not entirely trivial and I would rather not re-inve...
Hi everyone!
I have the following line:
"14:48 say;0ed673079715c343281355c2a1fde843;2;laka;hello ;)"
I parse this by using a simple regexp:
if($line =~ /(\d+:\d+)\ssay;(.*);(.*);(.*);(.*)/) {
my($ts, $hash, $pid, $handle, $quote) = ($1, $2, $3, $4, $5);
}
But the ; at the end messes things up and I don't know why. Shouldn't th...