Hey, first time poster on this awesome community.
I have a regular expression in my C# application to parse an assignment of a variable:
NewVar = 40
which is entered in a Textbox. I want my regular expression to return (using Regex.Split) the name of the variable and the value, pretty straightforward. This is the Regex I have so far:...
My application will basically accept user input via the main(String[] args) method. I have been trying to figure a way to do some checking with that input using a patter matcher.
Each valid input consists basically of a single character: (blanks should be ignored)
* 'R' or 'r' - replay
* 'Q' or 'q' - quit
* [1-6] - perform tasks 1 .. 6...
How do I have a regex statement that accepts any character except new lines. This includes anything but also includes new lines which is not what i want:
"/(.*)/"
...
I have to check the buffer input to a PHP socket server as fast as possible. To do so, I need to know if the input message $buffer contains any other character(s) than the following: a-z, A-Z, 0-9, #, -, . and $
I'm currently using the following ereg function, but wonder if there are ways to optimize the speed. Should I maybe use a diff...
Hi
I want to creat a regular expression for strings which uses special characters '[' and ']'.
Value is "[action]".
Expression I am using is "[\\[[\\x00-\\x7F]+\\]]".
I tried doing it by adding "\\"before '[' and ']'.
But it doesn't work.
Can any one help me with this.
thanks
-devSunday
...
Given the input
echo abc123def | grep -o '[0-9]*'
On one computer (with GNU grep 2.5.4), this returns 123, and on another (with GNU grep 2.5.1) it returns the empty string. Is there some explanation for why grep 2.5.1 fails here, or is it just a bug? I'm using grep -o in this way in a bash script that I'd like to be able to run on di...
I want to match a phone number that can have letters and an optional hyphen:
This is valid: 333-WELL
This is also valid: 4URGENT
In other words, there can be at most one hyphen but if there is no hyphen, there can be at most seven 0-9 or A-Z characters.
I dont know how to do and "if statement" in a regex. Is that even possible?
...
I have a sample set of XML returned back:
<rsp stat="ok">
<site>
<id>1234</id>
<name>testAddress</name>
<hostname>anotherName</hostname>
...
</site>
<site>
<id>56789</id>
<name>ba</name>
<hostname>alphatest</hostname>
...
</site>
</rsp>
I want to extract everything within <name></name> but not ...
Hi All,
I'll be the first to admit that my Regex knowledge is hopeless. I am using java with the following
Matcher m = Pattern.compile(">[^<>]*</a>").matcher(html);
while (m.find()) {
resp.getWriter().println(html.substring(m.start(), m.end()));
}
I get the following list:
>Link Text a</a>
>Link Text b</a>
What am I missing to re...
In Perl, how can I replace a pattern from the current position (the position of the last replacement) until the end of a line?
I have done all of these replacements in a single line:
...
s/\[//;
s/(\/\w\w\w\/)/ getMonth $1 /e;
s/:/ /;
s/\s\+\d\d\d\d\]//;
#NOW: replace all blanks with a plus sign from this position until the end of this...
Hi all,
Is there a guide to using regular expressions in objective c?
Specifically what to type into the "Reg. Ex." field in a core data property?
In particular, how to limit input to a set amount of numbers/letters only, and for UK Post Codes?
Thanks!
...
I'm trying to obtain the keywords from an HTML page that I'm scraping with PHP.
So, if the keywords tag looks like this:
<meta name="Keywords" content="MacUpdate, Mac Software, Macintosh Software, Mac Games, Macintosh Games, Apple, Macintosh, Software, iphone, ipod, Games, Demos, Shareware, Freeware, MP3, audio, sound, macster, napste...
Hi,
I am not familiar with C-like syntaxes and would like to write code to find & replace, say, all 'A's to 'B's in a source string, say 'ABBA' with the Regexp package ReplaceAll or ReplaceAllString functions? How do I set up type Regexp, src and repl? Here's the ReplaceAll code snippet from the Go documentation:
// ReplaceAll returns...
I am not Yahoo Pipes user but I do not know anything about programming.
I use Yahoo Pipes to generate RSS feeds from several websites that allow me to use their feeds on my site. What I need is to clean up these sites from all the unwanted styles like this:
<div style="font-family:Tahoma, Geneva, sans-serif;font-size:12px;direction:rtl;...
I have a DNA file in the following format:
>gi|5524211|gb|AAD44166.1| cytochrome
ACCAGAGCGGCACAGCAGCGACATCAGCACTAGCACTAGCATCAGCATCAGCATCAGC
CTACATCATCACAGCAGCATCAGCATCGACATCAGCATCAGCATCAGCATCGACGACT
ACACCCCCCCCGGTGTGTGTGGGGGGTTAAAAATGATGAGTGATGAGTGAGTTGTGTG
CTACATCATCACAGCAGCATCAGCATCGACATCAGCATCAGCATCAGCATCGACGACT
TTCTATCATCATTCGGCGGGG...
I'd like to trim the output from uptime
20:10 up 23 days, 3:28, 3 users, load averages: 3.84 1.06 0.64
so that it just shows:
23 days
I've tried using sed, but I'm not sure it's the right tool for the job, and don't have much experience using it.
How can I achieve the output I want?
...
I use Regexp::Assemble in my project, but I don't understand why this little sample doesn't work:
#!/usr/bin/perl
use strict;
use warnings;
use Regexp::Assemble;
my $re1 = "(run (?:pre|post)flight script for .+)";
my $re2 = "((?:Configu|Prepa)ring volume .+)";
my $ra = Regexp::Assemble->new;
$ra->add($re1);
$ra->add($re2);
my $glo...
I want to make a wiki, and i must assign for each url a view. Each url can contain letters (A-Z, a-z), digits and punctuation ('.', ',', '/', '-', '_'). How can i make the expression ?
I want something like this :
(r'^(?P<wiki_page>\w+)/$', 'www.wiki.views.page')
but this works only for letters, digits and '_'.
...
Update: I'm thinking the solution to this problem is in CKEDITOR.config.protectedSource(), but my regular-expression experience is proving to be too juvenile to handle this issue. How would I go about exempting all tags that contain the 'preserved' class from being touched by CKEditor?
Is it possible to create a block of code within t...
Hey,
I've been learning regular expressions for the last few days and I've been stumbled on this one. I would like to split a string by commas but with exceptions. Here's my string on what I want to validate:
rp { av 100, re 3, 52 }
which is basic comma delimited values inside of curly braces. Getting the values, I can do. But inside...