jeudi 2 mars 2017

Java Regular Expression (Regex) , match this sequence

I need to match this sequence of characters. Any number of alphabetical characters or /< but not /

For example these strings should match

Mary<Jane<<hello
Mary<<Hello<<Hi
Mary<Jane<<Hello<HI

These shouldnt:

Mary<<jane<<hello  (only once can there be /</< together)
Mary<Hello<hi      (There isn't a two together /</<)

I've tried a lot of things. I cant figure out why this wouldnt work:

[A-Z]+[[[\<(?!\<)][[A-Z]+]]*][\<][\<][A-Z]+[[[\<(?!\<)][[A-Z]+]]*]

Aucun commentaire:

Enregistrer un commentaire