Questions tagged [pattern]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
76 views

Regex not working in class but works in execute anonymous

You can get some context here on my previous post. When I run the below code on execute anonymous, it renders the following result: String txt = 'Requesting service for Id Number 9202204720082, Case C ...
d_k's user avatar
  • 1,321
0 votes
1 answer
85 views

Regex for Case Number, South African Id and Passport

Please bear with me, I'm not well versed with Pattern, Matcher or Regex. I found the below on https://regex101.com/ South African passport: [A|D|M|T][0-9]{8} South African Id: (([0-9]{2})(0|1)([0-9])(...
d_k's user avatar
  • 1,321
0 votes
1 answer
232 views

Regex to find dd/mm/yyyy

I have a pretty simple code and in one case it works, and not in all the case, I wanted to know what I'm missing I'm trying to match a date in this format dd/mm/yyyy This is my code: String d = '20/03/...
Yaac0's user avatar
  • 155
0 votes
1 answer
126 views

Pattern.quote matches substring instead of whole word match

I was trying to implement a case insensitive whole word searching pattern. I came up with the following pattern: Pattern p = Pattern.Compile('(?i)'+Pattern.quote('af')); Using it in the code below: ...
Aman Sharma's user avatar
0 votes
1 answer
186 views

Pattern Matcher problem

I want to get the sub string 'fact.cm_comp_sales_adjustment_factor__c.living_area_default_index_score__c' in the string '[subj.cm_parcel__c.sqft__c]+[comp.cm_sale__c.sqft__c])*fact....
Tuấn Trần quốc's user avatar
1 vote
1 answer
62 views

How to optimize Searching bulk data for list of words

I have a spam detection mechanism which searches strings of word in posts. The List can be 500+ entries long sometimes. I have a naïve searching algorithm //Unnecessary logic have been removed public ...
AmanSharma's user avatar
1 vote
0 answers
361 views

Replace whitespace in part of a string

I have cases which contain urls in the case description, and the urls contain whitespace. I need to replace the whitespace with %20 in order to make the links clickable from the case. Obviously the ...
Bob McD's user avatar
  • 13
0 votes
1 answer
250 views

Matcher.matches() is not working as expected

I am trying to match DateTime input using the Pattern and Matcher class of Apex but wasn't able to achieve it. I've created a regex for matching the Datetime input as follows and it matches the ...
Hariprasath's user avatar
0 votes
1 answer
701 views

Not able to remove substring that is variable from a string

I want to remove everything except for Name. removeStart() and remove() don't seem to take variable as a parameter. String tmpField = '{!Contract.Name}'; String child = 'Contract'; tmpField = ...
ApexCowboy's user avatar
1 vote
2 answers
151 views

How put inner class into Apex enterprise Pattern Service layer?

I need use structure (or wrapper class) in Apex Enterprise Pattern. public with sharing class Structure { public String name { get; set;} public Integer limit {get; set;} private ...
oldgunner's user avatar
0 votes
1 answer
115 views

Apex Enterprise Pattern for universal usability

Everyone! I have a question - what if i don't want what kind of objects i will get? One day it is Accounts, next day - Opportunities, etc. Can I write Application.cls something like this? { // ...
oldgunner's user avatar
1 vote
0 answers
46 views

Locate email address within Case.Description using regex

My apex proficiency is pretty low so I may be on the wrong track on this. But I'm attempting to take an email address from a set Email to Case email we get and apply it to a field (I'll be doing ...
Michael Canelas's user avatar
1 vote
0 answers
146 views

Email pattern not working

Hi this pattern is not working in an Aura component and i've no idea why... <lightning:input aura:id="Eemail" name="email" value="{!v....
Héctor Cervera Panella's user avatar
0 votes
2 answers
187 views

Find all non-alpha characters in string (excluding special alpha chars) and capitalise each word before/after the character

I'm looking to capitalise each part of a string that precedes/follows a special character and found this post which does the trick nicely. Only problem is it also sees characters which are special ...
Irene's user avatar
  • 1,509
0 votes
1 answer
893 views

Regular expression is not working as expected in apex

I'm working on design patterns while I'm testing in the anonymous window it's working as expected. But when i trying to implement the same logic it's unable to find matches My expression:'^([0-9])\\1*$...
Pavan tej's user avatar
  • 1,444
2 votes
1 answer
3k views

How to set Pattern properties of LWC lightning-input in js controller

I'm trying to set Pattern property from Javascript Controller as otherwise I have to provide some sort of valid pattern property (such as [\\w\\W\\D\\S]{0,} for instance which accepts pretty much ...
BizNuge's user avatar
  • 121
-2 votes
1 answer
4k views

Regular Expression to get Street Name and Number Separately

I am using the compile method for the pattern class in order to separate digits (street house number) from a string into a number field, and the non-digits (street) into a string field. \d* gives me ...
Andrea Voggenreiter's user avatar
-1 votes
1 answer
273 views

Regex in Pattern.compile to split BillingStreet into custom street and house number field

I want to split BillingStreet into a custom Street__c and HouseNumber__c. According to what I have read so far online, I need to: Instantiate a new Pattern object //Pattern 'Test Street 123' OR '123 ...
Andrea Voggenreiter's user avatar
-1 votes
1 answer
7k views

Is it possible to do a "reverse regex" pattern match?

I have the following code: if(PATTERN_A.matcher(someValue).matches()){ model = MODEL_A; } else if(PATTERN_B.matcher(someValue).matches()){ model = MODEL_B; } else if(PATTERN_C.matcher(...
Brian Kessler's user avatar
3 votes
1 answer
1k views

Regex having issues in Apex

I found a Regex which retrieves the Parent domain from a URL. When I tried using the same Regex Expression in Apex using Pattern and Matcher, it's giving me an error of: Illegal string literal: ...
Kamal Thakur's user avatar
1 vote
0 answers
1k views

Import File Activity - File Naming Pattern / Wildcards - How far will the default go back in time?

My question is about wildcards / file name pattern inside automation studio. When you define a file name pattern inside an import file activity like FULL_IMPORT_%%Day%%%%Month%%%%Year%%.csv how will ...
Johannes Schapdick's user avatar
0 votes
1 answer
2k views

patern and matcher not working

I am using regex to find line which starts with 'aaaa' pattern myPattern = pattern.compile('^(aaaa)\b.*'); String a = 'aaaa,777,ttttt,rrrrrr'; a += '\n' + 'tttttt,ttttt,0000'; matcher myMatcher = ...
Manjot Singh's user avatar
  • 3,389
0 votes
1 answer
3k views

I am writing a regular expression to get the string between the curly bracket [closed]

I am trying to get all the string from a defined text using pattern class using regex. Pattern MyPattern = Pattern.compile('/[^{\}]+(?=})/g'); but it is throwing an error Illegal string literal: ...
user2815826's user avatar
8 votes
2 answers
9k views

Regex Help- Escaping Characters And Matcher Method

I have a string: allPunctuation = '~!@#$%^*()_+|}{":?><`=;/.,][-\'\\'; This string contains APEX's way of escaping characters so I can include the ' and the \ characters. When I pass this ...
Olivia's user avatar
  • 3,369
1 vote
1 answer
40 views

Need help with Pattern/Regular Experession [closed]

I want to check matching between string to string pattern that contain specific character as any. For example: Assume string pattern is: "TEST ***ING NUMBER *" For input: "TEST STRING NUMBER 1" ...
Liron C's user avatar
  • 1,706
1 vote
1 answer
4k views

Find a Particular Substring using Regex

I am trying my hands on Email Services, am stuck at a place where I need to create a regex. I want to find all substring which looks like "PIKA-170510-115943". Here is my code. String str='Strating ...
Pranay Jaiswal's user avatar
1 vote
2 answers
1k views

Pattern.Split doesn't behave as I've expected

Full doc on Pattern Class: Documentation Pattern Class Use case : So, whenever a Task is Created due to email to salesforce, I need to check if that emails content Body included one or more links ...
Alexander Aeons Torn's user avatar
3 votes
1 answer
44 views

Difficulty in using Patterns and Matchers in a single invocation

Salesforce example: Boolean Test = Pattern.matches('a*b', 'aaaaab'); I'm attempting to use regular expression on a condition to check if a string has "You Order # 1234: ", but it's always returning ...
user40801's user avatar
2 votes
2 answers
3k views

regular expression problem (Pattern/Matcher)

I need to find specific word on a string using regular expression. rules : before that word, I must not have a letter, a number or an underscore. this word must be not followed by a letter, a number ...
Powerwave's user avatar
5 votes
2 answers
1k views

Find if a word from a list exist in a string

I am trying to find if a sentence contains at least 1 word from a different list of words. I am able to do this like below code, however my concern goes that the "theSentence" is a string that is ...
manza's user avatar
  • 1,945
0 votes
1 answer
233 views

How to filter out LF and CR from values in the cells of CSV file

We have an email service which accepts CSV attachment and has process its values and insert it into the objects. CsvReader class stop processing lines from CSV when there is "Line Feed" present inside ...
vlr's user avatar
  • 864
0 votes
2 answers
2k views

Simple APEX String Replacement - can't unencode quotation marks

I've tried quite a few different methods to unencode a simple string but nothing's turning up. That's the end of my API call, using a regex solution I found online, although it's not working out. ...
qarthandso's user avatar
3 votes
1 answer
1k views

Regex Pattern to Isolate Multiple Double Quoted Terms

The pattern below allows me to isolate a single term that is enclosed in double quotes. However i'd like to be able to isolate multiple terms that are double quoted and separate them if possible. ...
Antonio's user avatar
  • 57
1 vote
1 answer
549 views

How to split String Using REGEXP or Using Pattern class

This is My String 14-Mar-16,RTRDTG78BGXPBE3H,D-Link DIR-600M Wireless N150 Home Router,10-Apr-16, SECEBH7HZMKZMG3B,Kaspersky Internet Security 2016 1 PC 1 Year I want to split this string Where ever ...
Sharat's user avatar
  • 1,029
1 vote
0 answers
195 views

Trigger on Child record to update Parent Record and to create new Child records ( same ) [closed]

I have been trying to come up with the pattern in which i need to handle the below scenario ( considering recursion ). On Insertion of Child Record ( Object - B ) i need to update parent record ( ...
ForceDeveloper's user avatar
1 vote
2 answers
8k views

Apex regex to get html child tag and its content? [closed]

I have below HTML tag and i need to extract TAG child tag and its element. <h3 class="large lheight20 margintop10"> <a href="https://google.com" class="marginright5 link linkWithHash ...
MIX DML's user avatar
  • 2,422
3 votes
2 answers
2k views

Using wildcard in migration tool package xml

I know how to use tags for one object example: "Account_History__c". But I am looking for a way to select all objects that start with a specific pattern. In our org we prefix all objects with the ...
tggirish's user avatar
5 votes
1 answer
1k views

Regex: Make Dot Match Newline?

I use Rubular to test my regular expressions, when I need them. I am having a bit of trouble crafting an expression that will work for me. For reference, I am trying to match multiple substrings in ...
Adrian Larson's user avatar
  • 148k
2 votes
1 answer
434 views

Trigger patterns

There is a pattern outlined for writing the triggers in Salesforce here : http://developer.force.com/cookbook/recipe/trigger-pattern-for-tidy-streamlined-bulkified-triggers. How Apex Trigger Pattern ...
SFDCQuickFix's user avatar
1 vote
2 answers
2k views

File Naming Pattern within import on seconds

I have a Import that uses the File Naming Pattern etsync_%%Year%%%%Month%%%%Day%%%%Hour%%%%Minute%%%%Second%%.csv and it is used in a Triggered Automation, would the Automation be fast enough to ...
Bidstrup's user avatar
  • 493
2 votes
1 answer
20k views

Regular Expression for words with spaces

I want to check for the following strings using regExpression: 1) Main-xxxxx-Accepted 2) Main-xxx xxx-Accepted I used the below String regEx = 'Main-[aA-zZ-]*-Accepted'; Pattern.matches(regEx,'...
sfdcFanBoy's user avatar
  • 4,021
1 vote
1 answer
511 views

Regex Pattern/Matcher optional html attributes

So I am trying to make a pattern matcher that would read a block of html and identify the labels and ids of certain fields on the page. I am trying to find a way to read the label tag and parse ...
Louis Pujol's user avatar
  • 1,235