Modify ↓
Opened 15 years ago
Closed 15 years ago
#8510 closed defect (worksforme)
Regex not working properly
| Reported by: | Owned by: | Richard Liao | |
|---|---|---|---|
| Priority: | normal | Component: | TracTicketValidatorPlugin |
| Severity: | normal | Keywords: | |
| Cc: | Trac Release: | 0.11 |
Description (last modified by )
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)
Change History (4)
Changed 15 years ago by
comment:1 Changed 15 years ago by
| Description: | modified (diff) |
|---|
comment:2 Changed 15 years ago by
| Status: | new → 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 15 years ago by
| Resolution: | → worksforme |
|---|---|
| Status: | assigned → closed |
Working, sorry for the inconvenience. I'll check if the documentation has this note, or i was who slipped over it.
Thanks!
Note: See
TracTickets for help on using
tickets.



Regex right, in trac is not working.