1

I have a text box to input.

<asp:TextBox ID="txt_namepair" runat="server" Text="<Name>=<Value>">
</asp:TextBox>

I want to add validation using regular expression validator. Now I need regular expression to check the input format as

"alpha numeric string = alphanumeric string"  
 like <name>=<value> pairs.

When I click on add button those = pairs will be displayed in a listbox.But what I wanted is, I want to check whether those , pairs have equal sign(=) between them by using regular expression. And and pairs should be alpha numeric characters.

Greg
  • 481
  • 1
  • 5
  • 21
  • You can have a look at this [answer](http://stackoverflow.com/a/336220/1012641) on SO and modify it as per your needs. The user here has explained everything well – Patrick D'Souza Apr 10 '13 at 05:53

1 Answers1

0

You can use the following regular expression

^[a-zA-Z0-9 ]*=[a-zA-Z0-9 ]*$

to match your string

"alpha numeric string = alphanumeric string"

P.S. Do you really need spaces? If not delete the space from the regular expression after 9.

You can test the code I have provided at the following site http://regexhero.net/tester/

Patrick D'Souza
  • 3,491
  • 2
  • 22
  • 39