Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Minus (-) into pattern but constrain is Munis (-) should not be first character

Status
Not open for further replies.

Sunil Sharma

Programmer
Nov 29, 2022
1
BE
<xs:pattern value="^[a-zA-Z0-9\?\,\+\:\(\)\.\'\/ ]{0,105}$" />

This is the pattern where I need to add Minus (-) but restriction is that Minus (-) should not be a first character

Can we write like this?

<xs:pattern value="^[a-zA-Z0-9\?\,\+\:\(\)\.\'\-\/ ]+!^[-]{0,105}$" />
 
If only this original pattern could be on beginning
[a-zA-Z0-9\?\,\+\:\(\)\.\'\/ ]
and minus could follow after that i think that something like this:
Code:
^[highlight #FCAF3E]([/highlight][a-zA-Z0-9\?\,\+\:\(\)\.\'\/ ][highlight #FCE94F][\-]*[/highlight][highlight #FCAF3E])[/highlight]{0,105}$
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top