I would like to scan a specific select tag for all the option-tags values and content in PHP. So that from this
<select>
<option value="donald">duck</option>
<option value="david">moose</option>
</select>
<select id="something"> <!--ignore this one -->
<option value="sdfas">fs</option> <!-- ignore this one -->
...
I would get somethin...
I have done some testing but I wanted to ask if anyone sees a problem with this ruby regular expression for email validation:
/\A([^@\s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})\Z/i
Look good?
Thanks,
Tony
...
What's a regex pattern to trim the hyphens from the start and end of a string?
-----name1-name2-----
should become
name1-name2
^(-+).+(-+)$ doesn't seem to work...
...
I have something like the following in a string:
blah blah
BEGINIGNORE
this stuff should get stripped out
ENDIGNORE
more stuff here
I would like to do this (perl syntax): s/BEGINIGNORE.*ENDIGNORE//s -- namely, strip out everything between BEGINIGNORE and ENDIGNORE, inclusive.
You would think the following would do that in Mathema...
I have a txt file and each line has a set of random strings, I need to select only the lines that contains only the characters: 1234567890qwertyuiopasdfghjklzxcvbnm-._~
I'm reading line by line and verifying char by char, I don't think it's the best way to do that, and I think a RegEx would be perfect.
So can anybody help with with a p...
Duplicate:
Best Language for String Manipulation?
I have to parse hundreds of text files per second, each file containing multi subject text (consider, for example, it's email text). I need to find various patterns (keywords, sentences, most important words and stuff like that). I need to know what is the fastest programming langua...
Hi guys, I was wondering if you could help me formulate a regular expression to match the following pattern?
Any arbitrary length string of numbers, which may or may not be preceded by 0x.
...
I want to restrict the users from entering the below special characters in a field:
œçşÇŞ
ğĞščřŠŘŇĚŽĎŤČňěž
ůŮ
İťı
—¿„”*@
Newline
Carriage return
A few more will be added to this list but I will have the complete restricted list eventually.
But he can enter certain foreign characters like äöüÄÖÜÿï etc in addition to alphanumeric char...
I need a regular expression that can capture the data from a description like this:
14Kt Yellow Gold Mothers Ring Style
152, Genuine Amethyst,Genuine
Diamond,Simulated Emerald,Premium
Topaz,Premium Tourmaline,Genuine
Sapphire, Engravings:
jim,jake,john,jeff,rob,sandy, Band
Engraving: smith
What I need to capture is:
A)...
Hi guys, i have some regexp (like ^\w+[\w-.]\@\w+((-\w+)|(\w)).[a-z]{2,3}$, to match correct emails), but i cant figure out how to remove everythings that dont match the regexp in my string.
Keeping the email example, i need a way to, given a sting like
$myString = "This is some text, the email is here [email protected], and other th...
Basically I have an xml document and the only thing I know about the document is an attribute name.
Given that information, I have to find out if that attribute name exists, and if it does exist I need to know the attribute value.
for example:
<xmlroot>
<ping zipcode="94588" appincome = "1750" ssn="987654321" sourceid="XX9999" sourc...
Hey again i asked a question the other day about removing html tags with regular expressions.
Well now i am wondering is there any way to use this on regular expression but add to it? So that it could also remove links beggining with http and ending with .stm or .gif?
This is the piece of code im using:
string BBCSplit = Regex.Repla...
I often find myself needing a tool that would allow me to:
search for multiple multi-line regex patterns in a large file and replace them using back-referencing.
Should I:
take the 2 hours it'll require to build myself such a tool
use something someone has already built (please suggest)
learn to use a language that's particularly goo...
Edit: The problem described below was just caused by a "feature" of my IDE, so there's actually nothing wrong with the regex. If you're interested in how to double line breaks, here's your question and answer in one neat package. :)
I want to change every line break in a string to be two line breaks:
"this is
an example
string"
// ...
I have started to feel that using regular expressions decreases code maintainability. There is something evil about the terseness and power of regular expressions. Perl compounds this with side effect like default operators.
I DO have a habit of documenting regular expressions with at least one sentence giving the basic intent and a...
I have an HTML document of this format:
<tr><td colspan="4"><span class="fullName">Bill Gussio</span></td></tr>
<tr>
<td class="sectionHeader">Contact</td>
<td class="sectionHeader">Phone</td>
<td class="sectionHeader">Home</td>
<td class="sectionHeader">Work</td>
</tr>
<tr valign="top">
...
Given the following input string 3481.7.1071.html
I want to confirm that
The string has 1 or more numbers followed by a period.
The string ends in html.
Finally, I want to extract the left-most number (i.e. 3481).
My current regex is nearly there but I can't capture the correct group:
final Pattern p = Pattern.compile("(\\d++\\....
In SQLSERVER/MSSQL, here's the problem:
SELECT * from [Translation Color] order by [Language Code]
I want records ordered in alphabetical order starting by the 'I' letter.
Example of result:
'Ioren'
'Iumen'
'Tart'
'Arfen'
'Coldry'
I don't want to use union or more sql statements.. just try to catch it with an order by special claus...
Continuing with the post at
http://stackoverflow.com/questions/705672/regular-expression-to-allow-a-set-of-characters-and-disallow-others/705990#705990
Does anybody know why the below would occur?
I get the below error when I create a regular expression as:
[^@*–’”“\r\nœçsÇSgGšcrŠRNEŽDTCnežuUIti—¿„”]+
and enter any of these restrict...
I need to remove blank lines (with whitespace or absolutely blank) in PHP. I use this regular expression, but it does not work:
$str = ereg_replace('^[ \t]*$\r?\n', '', $str);
$str = preg_replace('^[ \t]*$\r?\n', '', $str);
i want result of:
blahblah
blahblah
adsa
sad asdasd
will:
blahblah
blahblah
adsa
sad asdasd
...