You need to sign in to do that
Don't have an account?
Pattern and Matcher apex
Hi,
I am using pattern and matcher to [@name1]. Below is the regex
String mentionName = pm.group(1);
Everything is works fine if it has only one [@name1] with specified pattern.
If it has more than one like [@name1] [@name2] only one value is returned. is it possible to get more than one value from the group?
I am using pattern and matcher to [@name1]. Below is the regex
Pattern.compile('\\[\\@([a-z|A-Z|0-9].*?)\\]');Using the matcher to get the values
String mentionName = pm.group(1);
Everything is works fine if it has only one [@name1] with specified pattern.
If it has more than one like [@name1] [@name2] only one value is returned. is it possible to get more than one value from the group?
Does that work fine for you?
Hi Shingo,
Thank you. But my problem is I am replacing the [@name] with some HTML and appending it.
I need to replace [@name] with a tag even if it has more than one pattern matched value
Then, how about replacing the matched part every time in for loop?