I'm trying to use a regular expression to capture the contents of all option values inside an HTML select element
For example, in:
<select name="test">
<option value="blah">one</option>
<option value="mehh">two</option>
<option value="rawr">three</option>
</select>
I'd like to capture one two and three into an array.
My current code...
Hi Guys,
I have a question regarding .NET regular expressions and how it defines matches.
I am writing:
var regex = new Regex("<tr><td>1</td><td>(.+)</td><td>(.+)</td>");
if (regex.IsMatch(str))
{
var groups = regex.Match(str).Groups;
var matches = new List<string>();
for (int i = 1; i < groups.Count; i++)
matches.A...
Recently I came across a character range that was the following:
[/-+]
My very simple question is, is this even a valid character range? If so, what range of characters would it match?
...
Before you say "oh no, not again" here I'm stating my case. I'm parsing part of HTML output and the only thing I'm interested in is name and value attributes of each <input/> tag. HTML is actually HTML fragment, may not be well-formed. I don't have DOM or HTML parser and I don't try to parse nested elements anyway. The problem is that I ...
Take the following file...
ABCD,1234,http://example.com/mpe.exthttp://example/xyz.ext
EFGH,5678,http://example.com/wer.exthttp://example/ljn.ext
Note that "ext" is a constant file extension throughout the file.
I am looking for an expression to turn that file into something like this...
ABCD,1234,http://example.com/mpe.ext
ABCD,1234...
How to define regular expression of mathematical expression.please define a common regular expression for
5+4
5-3
5*6
6/2
...
I am trying to extract a number from a string. The number might be zero. Numbers appear like this: '+123', '-8' or '0'.
alert( '+123'.match(/[-?|+?]\d+/) );
alerts +123
alert( '-8'.match(/[-?|+?]\d+/) );
alerts -8
alert( '0'.match(/[-?|+?]\d+/) );
alerts null // why oh why?
How do I get '0'.match(/[-?|+?]\d+/) to return 0 instead of...
Is it possible to use a regular expression to get filenames for files matching a given pattern in a directory without having to manually loop through all the files.
...
I'm currently trying to solve a problem that's similar to http://stackoverflow.com/questions/2338716/testing-intersection-of-two-regular-languages with the exception that I know how to do the intersection, but have an additional requirement.
The intersection logic I intend to use is the Dragon Book's algorithm for converting an NFA to a...
So for the string:
A large chicken, either thighs or breasts
I need a regex to match the term "chicken breast"
So it would be something like /chicken(.*?)breast/ would it not?
Thanks.
...
Hi all,
Please could someone help me, i will be forever appreciative.
I'm trying to create a regular expression which will extract 797 from "Your job 797 ("job_name") has been submitted"
or "Your Job 9212 ("another_job_name") has been submitted" etc.
Any ideas? Thanks guys!
...
First off, sorry for the lame title, but I couldn't think of a better one. I need to test a password to ensure the following:
Passwords must contain at least 3 of the following:
upper case letters
lower case letters
numbers
special characters
Here's what I've come up with (it works, but I'm wondering if there is a better way to do t...
I let my users enter a search term: "foo bar".
I would to convert the user query to a string that matches the words, but ignoring the order:
bla foo bla bar = match
^^^ ^^^
bla bar bla foo = match (order = reversed)
^^^ ^^^
bla bla bla foo = no match (only one word)
^^^
bar bla bla bla = no match (on...
Hi there,
I am currently trying to write a regular expression to pull links out of a page I have. The problem is the links need to be pulled out only if the links have 'stock' for example. This is an outline of what I have code wise:
<td class="prd-details">
<a href="somepage">
...
<span class="collect unavailable">
...
</t...
I want to validate login name with special characters !@#S%^*()+_-?/<>:"';. space using regular expression in ruby on rails. These special characters should not be acceptable. What is the code for that?
Thanks,
Pallavi
...
I'm trying to view the text of HTML files in a reasonable way. After I remove all of the markup and retain only the visible text, I obtain a String that looks something like this:
\n\n\n\n \n\n\n \n\n \n Title here \n\n\n \n\n \n\n Menu Item 1 \n\n \n\n Menu Item 2 \n\n\n \n\n you get the point.
I would like to use String.repla...
Hi!
i would like to avoid texts like this one: height="49" with a regular expresion.
I tought in .replaceAll("\s*="*"","");
(replaceAll is used as a method in a java class), but eclipse don't allowed me to do that.
Any other suggestion??
tx!
...
I know it is quite some weird goal here but for a quick and dirty fix for one of our system we do need to not filter any input and let the corruption go into the system.
My current regex for this is "\^.*"
The problem with that is that it does not match characters as planned ... but for one match it does work. The string that make it n...
I'm pretty new to regular expressions, and MAN do they give me a headache. They are so intimidating! For an email campaign I'm doing, a user will click a link out of the email with a few URL parameters filled in for them, to make filling out a form easier. I want to prevent any injection hacks or whatever it's called, but need to allow t...
Hello Everyone
i have about 100,000 strings in database and i want to if there is a way to automatically generate regex pattern from these strings. all of them are alphabetic strings and use set of alphabets from English letters. (X,W,V) is not used for example. is there any function or library that can help me achieve this target in C#...