Fixing words in patient id

Dear Team,

I am using this regex for my patient id, regex(., ‘[1]{3}[ABCD]{1}-[0-9]{3}$’)

However, I want to fix ISP for data collectors. Please guide me how to do that?


  1. ISP ↩︎

Hi @Priyanka,

What do you mean by ISP? The internet service provider?

1 Like

Thats a code for the institute. I don’t want team to put IPS or SSP etc

@Priyanka, do you mean they should only be able to input ISP in uppercase for a text question type?

Hi Kalyan!

So I want my data collector to put such inputs
ISPA001

ISPB002

ISPD003

ISPC004

So basically the ISP is fixed in the input.

@Priyanka, so you mean the entry should be in the following format?

  • The entry should be in 7-digit input.
  • Where the first three are fixed with ISP.
  • The fourth is an uppercase alphabet.
  • And the rest should be an integer.

Is this what you want?

Yes, ISP is fixed then forth is uppercase A or B or C or D and rest is 3 digit integer.

@Priyanka, if this is the requirement, then try using this regex code (it should solve your issue):

regex(., '^(ISP)[A-D]{1}[0-9]{3}$')

You should also be able to learn more about regex code through this support article Restricting Text Responses With Regular Expressions.

1 Like

Its is solved now. Thank you so much Hakan and Kalyan!

2 Likes

@Priyanka, :clap: :heart: :partying_face: