Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

What is the regex match space pattern?

Asked by Christopher Paterson May 16, 2023 955 views 1 answer
Share

About this question

I have the following values for a custom picklist field

  1. Lower - L1

  2. Upper - L2

  3. Side - L3

What is the regex pattern to match the above values?

Mainly this pattern

{anylength of string}{one space}{one hyphen}{one space}{L character}{one digit integer}
I have tried something this way but not working
String message = 'Upper - L2'; String regex = '[a-zA-Z\sL\s\d{1}]*'; Pattern regexPattern = Pattern.compile(regex); Matcher regexMatcher = regexPattern.matcher(message); if(regexMatcher.matches() == true) { System.debug('Matched'); }

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.