Modify

Opened 4 years ago

Closed 4 years ago

#8510 closed defect (worksforme)

Regex not working properly

Reported by: chronos.hun@… Owned by: richard
Priority: normal Component: TracTicketValidatorPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description (last modified by rjollos)

I've configure the trac.ini with the following:

[ticketvalidator]
validates = summary
summary.rule = [0-9]{1,10}[.][0-9]{1,6}
summary.tip = Please correct summary format
validates = cf_project
cf_project.rule = [A-Z]*[-][I][P][L][S]
cf_project.tip = Please correct project name (SOMETHING-IPLS)

I've tried the regex here: http://www.regexplanet.com/simple/index.html

Test Results
Regular Expression
Original Expression 	[0-9]{1,10}[.][0-9]{1,6}
as a Java string 	"[0-9]{1,10}[.][0-9]{1,6}"
Replacement 	
groupCount() 	0
Test 	Target String 	matches() 	replaceFirst() 	replaceAll() 	lookingAt() 	find() 	group(0)
1 	12.12 	Yes 			Yes 	Yes 	12.12
2 	a12.12 	No 	a 	a 	No 	Yes 	12.12
3 	1212 	No 	1212 	1212 	No 	No
4 	12.12a 	No 	a 	a 	Yes 	Yes 	12.12
5 	23PO-IPLS 	No 	23PO-IPLS 	23PO-IPLS 	No 	No
6 	0000001014.0000132 	No 	2 	2 	Yes 	Yes 	0000001014.000013
7 	0000001014.000013 	Yes 			Yes 	Yes 	0000001014.000013

So it should work. Could you have a look? Thank you,Chronos

Attachments (1)

trac.png (26.4 KB) - added by chronos.hun@… 4 years ago.
Regex right, in trac is not working.

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by chronos.hun@…

Regex right, in trac is not working.

comment:1 Changed 4 years ago by rjollos

  • Description modified (diff)

comment:2 Changed 4 years ago by richard

  • Status changed from new to assigned

When validate more than one fields, the config should like this:

[ticketvalidator]
validates = summary, cf_project
summary.rule = [0-9]{1,10}[.][0-9]{1,6}
summary.tip = Please correct summary format
cf_project.rule = [A-Z]*[-][I][P][L][S]
cf_project.tip = Please correct project name (SOMETHING-IPLS)

comment:3 Changed 4 years ago by chronos.hun@…

  • Resolution set to worksforme
  • Status changed from assigned to closed

Working, sorry for the inconvenience. I'll check if the documentation has this note, or i was who slipped over it.

Thanks!

Add Comment

Modify Ticket

Action
as closed The owner will remain richard.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.