function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Test Dev 81Test Dev 81 

create regex Exp to match string's

hi everyone,
I want to create a regex expression to match two strings
if one of the string is a match then regex will show success string else it will show error string, 
If my input equals to next OR prev it should show Success else Error
here I have created a regex but I am not sure  it is working
(?(?=next|prev) Success|Error)

User-added image
SwethaSwetha (Salesforce Developers) 
HI ,
Your question seems off-topic for the Salesforce forum and is best posted on https://stackoverflow.com/ for better inputs and right visibility.

Related: https://stackoverflow.com/questions/6863518/regex-match-one-of-two-words
 
balu M 3balu M 3
result = 'Success' if re.match(r'next|prev','your string') else  'Error'
print(result)