Hello,
I'm validating a text field in my form as follows:
$name = new Zend_Form_Element_Text('name');
$name->setLabel('First Name:')
->setRequired(true)
->addFilter(new Zend_Filter_StringTrim())
->addValidator('regex',true,array('/^[(a-zA-Z0-9)]+$/'))
->addErrorMessage('Please enter a valid first name');
Wha...
I am trying to write a RegEx rule to find all a href HTML links on my webpage and add a 'rel="nofollow"' to them.
However, I have a list of URLs that must be excluded (for exmaple, ANY (wildcards) internal link (eg. pokerdiy.com) - so that any internal link that has my domain name in is excluded from this. I want to be able to specify e...
Deal experts,
I am kinda new to this Regex thing.
When I was analyzing some codes, I frequently come across the pattern .+? or (.+?)
I can't seem to find the meaning of this pattern using my noobish deductive reasoning.
...
I have a string of names like this "J. Smith; B. Jones; O. Henry"
I can match all but the last name with
\w+.*?;
Is there a regular expression that will match all the names, including the last one?
...
I'm trying to practice writing better code, so I wanted to validate my input sequence with regex to make sure that the first thing I get is a single letter A to H only, and the second is a number 1 to 12 only. I'm new to regex and not sure what the expression should look like. I'm also not sure what type of error R would throw if this ...
Hi all, let's say I have two regexp's,
/eat (apple|pear)/
/I like/
and text
"I like to eat apples on a rainy day, but on sunny days, I like to eat pears."
What I want is to get the following indexes with preg_match:
match: 0,5 (I like)
match: 10,19 (eat apples)
match: 57,62 (I like)
match: 67,75 (eat pears)
Is there any way to ...
I can't get around this for quite sometime now. As I read along manuals and tutorials I'm getting more confused. I want an if statement with the following logic:
if [ -n $drupal_version ] && [[ "$drupal_version" =~ DRUPAL-[6-9]-[1-9][1-9] ]]; then
but I can't get it to work properly.
When the script is evaluated using the "bash -x .....
I need to ensure that the input value contains at least one dot, so i use the following:
<asp:RegularExpressionValidator runat="server" ControlToValidate="MyInput" Text="*" ErrorMessage="must contain at least one dot" ValidationExpression="\.+" />
And that doesn't work. By inspecting the page source i can see that ASP.NET escapes the ...
I'm currently trying to wrap my head around regex, I have a validation snippet that tests an input box against a regex-expression:
$.validator.addMethod("customerName", function(value, element){
return (/^[a-zA-Z]*$/).test(value);
}, "Some text");
That works well, but when I try to add a space and some special danish characters, it do...
Hi,
I have a textbox and a regular expression validator applied to it. I want to make sure that the only allowed string inputted into the textbox are "Anything Entered" or "Something Else" or "Another String" otherwise I want an error to be displayed.
This is the regular expression I have so far:
ValidationExpression="(^Anything Enter...
http://jamienay.com/2009/12/a-better-postal-zip-code-validation-method-for-cakephp-1-2/
i want to do the validation for zip code in FBJS for us and canada.
suggest some script or how to convert the about php code(in link) to fbjs
...
Hi,
I have a huge text file with lots of lines like:
asdasdasdaasdasd_DATA_3424223423423423
gsgsdgsgs_DATA_6846343636
.....
I would like to do, for each line, to substitute from DATA_ .. to the end, with just empty space so I would get:
asdasdasdaasdasd_DATA_
gsgsdgsgs_DATA_
.....
I know that you can do something similar with:
...
I have some text like this:
dagGeneralCodes$_ctl1$_ctl0
Some text
dagGeneralCodes$_ctl2$_ctl0
Some text
dagGeneralCodes$_ctl3$_ctl0
Some text
dagGeneralCodes$_ctl4$_ctl0
Some text
I want to create a regular expression that extracts the last occurrence of dagGeneralCodes$_ctl[number]$_ctl0 from the text above.
the result should ...
I have a sort of mini parsing syntax I made up to help me streamline my view code in cakephp. Basically I have created a table helper which, when given a dataset and (optionally) a set of options for how to format the data will render out a table, as opposed to me looping though the data and editing it manually.
It allows the user to be...
Hi,
i have various strings that look like that:
$(gateway.jms.jndi.ic.url,0,tibjmsnaming, tcp)/topic/$(gateway.destination.prefix)$(gateway.StatusTopicName),$(gateway.jms.jndi.ic.username),$(gateway.jms.jndi.ic.password),abinding,tBinding
i'm trying to figure out a way to extract the $(...) sections and replace them with some other s...
Hi everyone,
I need some help about RegExp in AS3.
I have a simple pattern :
patternYouTube = new RegExp ( "v(?:\/|=)([A-Z0-9_-]+)", "gi" );
This pattern is looking for the youTube id video.
For example :
var tmpUrl : String;
var result : Object;
var toto : Array = new Array();
toto = ["http://www.youtube.com/v/J-vCxmjCm-8&am...
Looking for some help!
I need to split a string at the last occurrence of a space...
e.g. "Great Neck NY" I need to split it so I have "Great Neck" and "NY"
I haven't had a problem using preg_split with basic stuff but I'm stumped trying to figure out how to tell it only to split at the last occurrence! Any help would be appreciate...
Hello!
I am creating a small Yahtzee game and i have run into some regex problems. I need to verify certain criteria to see if they are met. The fields one to six is very straight forward the problem comes after that. Like trying to create a regex that matches the ladder. The Straight should contain one of the following characters 1-5. ...
I have following rewrite rule to append .aspx extension if url has no extension.
<rule name="SimpleRewrite" stopProcessing="true">
<match url="^(.*(?<=/)([^/.]*))$" />
<action type="Rewrite" url="{R:1}.aspx" />
</rule>
However the rule is not working:
Error HTTP 500.52 - URL Rewrite Module Error.
The ex...
I need an simple way to check whether a string that is sent to my function is of the form:
(x + n)(x + m)
//the +'s can be minus'
//n and m represent a double
//x represents the char 'x'
Is there a simple string format that I can use to check that this is the form. As opposed to checking each character singularly.
The whitespace wil...