Hi,
I have a String "REC/LESS FEES/CODE/AU013423".
What could be the regEx expression to match "REC" and "AU013423" (anything that is not surrounded by slashes /)
I am using /^>*/, which works and matches the string within slash's i.e. using this I am able to find "/LESS FEES/CODE/", but I want to negate this to find reverse i.e. REC a...
Hi,
Is there a way of determining if the regular expression only matches fixed-length strings ?
My idea would be to scan for *,+ and ? Then, some intelligent logic would be required to to look for {m,n} where m!=n.
It is not necessary to take the | operator into account.
Small example: ^\d{4} is fixed-length; ^\d{4,5} or ^\d+ are variab...
Part of a series of educational regex articles, this is a gentle introduction to the concept of nested references.
The first few triangular numbers are:
1 = 1
3 = 1 + 2
6 = 1 + 2 + 3
10 = 1 + 2 + 3 + 4
15 = 1 + 2 + 3 + 4 + 5
There are many ways to check if a number is triangular. There's this interesting technique that uses re...
I've been trying to read about and test various regular expression testers to find my solution but to no avial. I'm using:
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
ErrorMessage='<%# "*"%>' ValidationExpression="," runat="server"
ControlToValidate="edit_email" Display="Dynamic"
EnableClientScript="true"></asp:Re...
Hi I have the next code :
var str = "4 shnitzel,5 ducks";
var rgx = new RegExp("[0-9]+","g");
console.log( rgx.exec(str) );
The output on chrome and firefox is ' ["4"] ',
Why I don`t get the next result - ["4","5"] ?
...
I have this code in a var.
<html>
<head>
.
.
anything
.
.
</head>
<body anything="">
content
</body>
</html>
or
<html>
<head>
.
.
anything
.
.
</head>
<body>
content
</body>
</html>
result should be
...
I have a string which I want to use in a regular expression it a way like m/$mystring_03/ however $mystring contains +s and slashes that cause problems. Is there a simple way in Perl to modify $mystring to ensure all regular expression wildcards or other special characters are properly escaped? (like all + turned into \+)
...
I may have a string for example potato in a vb.net application. I want to find all the occurrences of o and convert them to 0, so the desired out is: p0tat0.
I know it can be done by the provided string operations but I need a regular expression in my scenario.
How can this be done?
...
Hi-- I am trying to use PHP preg_math parse a string that looks like:
6.15608128 Norwegian kroner
I just want the first part (the digits), not the text. I wrote a simple regex like
[0-9\.]+
that works fine in regex testers, but PHP complains about the '+'. Can anyone help me write this regex so it's valid for the preg_match funct...
I'm pulling out my hair over the following function:
Public Function SetVersion(ByVal hl7Message As String, ByVal newVersion As String) As String
Dim rgx = New Regex("^(?<pre>.+)(\|\d\.\d{1,2})$", RegexOptions.Multiline)
Dim m = rgx.Match(hl7Message)
Return rgx.Replace(hl7Message, "${pre}|" & newVersion, 1, 0)
End Function
...
Hi all, thanks for the answers to :
"regular expression to detect numbers written as words" :
http://stackoverflow.com/questions/3608159/regular-expression-to-detect-numbers-written-as-words
I now have this working, however I have the same requirement but the numbers as words are in Arabic (or any other UTF-8) and not English, so :
i...
Let's say we have regular expressions:
Hello W.*rld
Hello World
.* World
.* W.*
I would like to minimize the number of regexes required to match arbitrary input.
To do that, I need to find if one regular expression matches any input matched by another expression. Is that possible?
Billy3
...
Hello,
I have the following bit of HTML:
<p><a href="http://vimeo.com/13114334" title="Grain & Gram: Nick Sambrato, Printmaker"><img src="http://b.vimeocdn.com/ts/747/476/74747630_200.jpg" alt="Grain & Gram: Nick Sambrato, Printmaker" /></a></p>
<p>Read the full interview with Nick Sambrato, Printmaker here:<br /><br /><a href="http://...
I'm trying to validate a textbox containing a variety of accepable inputs:
"123456789"
"123456789+1"
""
I'm using this regular expression to validate the first two conditions:
^[0-9]{9}\+[0-9]$
But now I can't figure out how to allow the user not to enter anything, I've tried things like encapsulating the expression in ()? , or c...
Hello,
I have several text boxes in an ASP.NET Web Form. I want to ensure that users are not entering HTML into those text boxes. However, I'm not sure how to prevent HTML from being entered. Because of this, I decided that I want to only allow alphanumeric characters, spaces, exclamation point, sharp sign, dollar signs, percentage sign...
Is there a way using a regex to match a repeating set of characters? For example:
ABCABCABCABCABC
ABC{5}
I know that's wrong. But is there anything to match that effect?
Update:
Can you use nested capture groups? So Something like (?<cap>(ABC){5}) ?
...
I'm using Fancy Upload 3 and onSelect of a file I need to run a check to make sure the user doesn't have any bad characters in the filename. I'm currently getting people uploading files with hieroglyphics and such in the names.
What I need is to check if the filename only contains:
A-Z
a-z
0-9
_ (underscore)
- (minus)
SPACE
ÀÈÌÒÙàèìòù...
I am trying to match URLs with a tested Regex expression but when I use JavaScript to evaluate it returns false.
Here is my code:
var $regex = new RegExp("<a\shref=\"(\#\d+|(https?|ftp):\/\/[-a-z0-9+&@#\/%?=~_|!:,.;\\(\\)]+)\"(\stitle=\"[^\"<>]+\")?\s?>|<\/a>");
var $test = new Array();
$test[0] = '<a href="http://www.nytimes.com/imag...
I have a div tag that contains a textbox and a submit button. I am trying to only have the submit button work if the text entered is a number (int or decimal). However when running the debugger, the onclick function is called no matter what text is entered. Any idea how I messed this up?
<div class="content">
<table class="inputForm"...
Hello all,
I'm not a Ruby programmer, but as I was reading through the extensive RoR security guide I noticed this section:
http://guides.rubyonrails.org/security.html#regular-expressions
A common pitfall in Ruby’s regular expressions is to match the string’s beginning and end by ^ and $, instead of \A and \z.
Does anyone know if...