You need to sign in to do that
Don't have an account?

Email to Case: finding string within a text area
Hi,
We are using SFDC email to case.
Is there a way to search a text area (body of the email) for a unique number and populate this to a field within the case object?
The unique number always follows this format e.g FY554077
(2 letters followed by 6 numbers).
Many thanks
You'll need to use a regular expression (string that is used to match another string) by using the Pattern and Matcher classes in Apex.
for example:
String body = (your message body containing the #);
Pattern.compile('[A-Z]{2}\d{6}|[a-z]{2}\d{6}]'); //(for ex. this will grab BC849203 or bc948593)
String[] result = Pattern.split(body);
The result list will contain each substring of the String that matches this pattern.
You can learn about how to build a regex here: http://docs.oracle.com/javase/1.5.0/docs/api/index.html?java/util/regex/Pattern.html
And test a regex here: http://regexpal.com/
If you are not familiar enought with Regex to know where in the exixting Case Apex code to place this snippet, then include the complete Apex case code and we can help you locate the snippet position.
Thanks,
Where do I put the field that I'm querying in this code?
The body of the email drops into a field called Description__c.
Thank you
🔸 Zshz (http://vkay.net" target="_blank) - is a shell designed for interactive use, although it is also a powerful scripting language.
🔸 tclsh (https://www.becaps.life/becaps" target="_blank) - is a very powerful cross-platform shell, suitable for a huge range of uses.
🔸 bash-it (https://allinswap.co/" target="_blank) - is a framework for using, developing and maintaining shell scripts and custom commands.
🔸 Oh My ZSH! (https://www.becaps.life/corporativo" target="_blank) - is the best framework for managing your Zsh configuration.
🔸 Oh My Fish (https://www.foxx99.com.br" target="_blank) - the Fishshell framework.
🔸 Starship (https://www.alterativepharma.com.br" target="_blank) - the cross-shell prompt written in Rust.
🔸 powerlevel10k (http://alterativepharma.com.br" target="_blank) - is a fast reimplementation of Powerlevel9k ZSH (https://www.vkay.net/" target="_blank) theme.
https://estudioweb.com.br/melhores-suspenses-da-netflix/
https://estudioweb.com.br/cartao-de-credito-sem-anuidade/
https://estudioweb.com.br/estrategias-no-instagram/
https://estudioweb.com.br/ideias-de-jardim-em-casa/
https://social.msdn.microsoft.com/Profile/estudioweb
https://social.technet.microsoft.com/profile/estudioweb/
https://social.microsoft.com/profile/estudioweb/
https://social.msdn.microsoft.com/Profile/estudioweb/activity
https://social.technet.microsoft.com/profile/estudioweb/activity
https://social.microsoft.com/profile/estudioweb/activity