urgently need help in writing a regular expression

Posted by Dbpradeep under Regular Expressions on 2/17/2012 | Points: 10 | Views : 1547 | Status : [Member] | Replies : 5
I need to write a regular expression such that
1. there should be minimum 3 characters
2. the first character is always /
3. the entire string shouldnot match the exact string '/abc' and '/xyz' but it can be anyother like /abce or /abct etc...




Responses

Posted by: Gow.net on: 2/17/2012 [Member] Starter | Points: 25
Posted by: Dbpradeep on: 2/17/2012 [Member] Starter | Points: 25

Up
0
Down
I have to do it in dojo. So I need the regular expression.
I mean someone has implemented it and I have to upgrade the code.

Dbpradeep, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pradeepkumar417 on: 2/18/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

Try this regular expression
using System.Text.RegularExpressions;


Regex regex = new Regex("^[/][a-z]{4,}$");
if (regex.IsMatch(TextBox1.Text))
{
Response.Write("Matched");
}
else
{
Response.Write("Not Matched");
}


Thanks & Regards,
Software Engineer,
Pradeep Kumar

Dbpradeep, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dbpradeep on: 2/18/2012 [Member] Starter | Points: 25

Up
0
Down
thank you pradeep... it was good but i didnt explain my entire problem properly
the check is actually in return statement

var existing = "";
if (this.disks.isLinux)
return "^/" + existing + "[^/][a-z]{4,}[^/]$";

Dbpradeep, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dbpradeep on: 2/19/2012 [Member] Starter | Points: 25

Up
0
Down
cont...
its in a javascript file!

Dbpradeep, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response