specify6 icon indicating copy to clipboard operation
specify6 copied to clipboard

Display sample input pattern for fields with regular expression formatters

Open timo11 opened this issue 5 years ago • 8 comments

timo11 avatar Apr 16 '21 15:04 timo11

a pattern attribute can be added to the format definition that is displayed during data entry. For example:

<format system="false" name="reg_num" class="edu.ku.brc.specify.datamodel.CollectionObject" fieldname="catalogNumber" default="false"> <field type="regex" size="15" minsize="11" value="MZB (\d{2}|\d{4})\-\d{4}(-[A-Z])?" pattern="MZB ####-####-A"/> </format> produces this:

864shot

timo11 avatar Apr 16 '21 15:04 timo11

Just so I'm clear, it also enforces the pattern i.e. MZB has to be MZB?

norinespears avatar Apr 16 '21 15:04 norinespears

The regular expression is enforced. The pattern/mask whatever is just an example. MZB-81-1234, MZB 1981-1234, are allowed by the reg ex but don't match the pattern.

timo11 avatar Apr 16 '21 15:04 timo11

Note --- The pattern probably can't have more characters than the size specified in the format definition.

timo11 avatar Apr 22 '21 21:04 timo11

Use the database that Tim converted for Barcelona to test.

norinespears avatar Jun 22 '21 15:06 norinespears

looks pretty

tlammer avatar Jul 27 '21 19:07 tlammer

Works in a fresh database

maxpatiiuk avatar Jul 27 '21 20:07 maxpatiiuk

Ups, didn't notice @tlammer has already tested this

maxpatiiuk avatar Jul 27 '21 20:07 maxpatiiuk