Hello,
Please help with regex code to extract the text before a keyword and include the keyword in the output.
Sample input string:
This is a test.ca ABC123
Fixed keyword: “.ca”
Expected output: test.ca
I tried this: \b.*(?<=).ca
But it’s extracting everything from the start of the line until the keyword.
Thanks
raool90
(Adrian Fanaca)
February 2, 2023, 9:37am
2
I recommend to get familiar with this website https://regexr.com/
Yoichi
(Yoichi)
February 2, 2023, 9:39am
3
Hi,
Can you try the following pattern?
\S*\.ca
Regards,
1 Like
Gokul001
(Gokul Balaji)
February 2, 2023, 9:40am
4
HI @6027ae06be5a67a04d29acc18
How about this pattern?
\S*\Wca
1 Like
Thanks for the suggestion. The period before “ca” is important to differentiate the keyword from other strings that could contain “ca”. This code doesnt work when I tried \S*\W.ca
system
(system)
Closed
February 5, 2023, 1:05pm
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.