Help with a regex expression - ORF Forums

Help with a regex expression RSS Back to forum


I was wondering if there was a way for my Keyword Filter to pick up the character { or }? I've been trying different combinations and testing but don't seem to have it down.

by Kwan Lau 8 years ago

@Kwan Lau: Both { and } are special characters in regular expressions and need to be "escaped" with \ to make them treated as regular characters. For instance, "product {sale}" should be written as "product \{sale\}". Curly braces (as special characters) are used to represent repetition in regexs - the expression "a{5}" means exactly five "a" characters, "a{5,}" means minimum five "a" characters and "a{5,10}" means 5 to 10 "a" characters. Without escaping I think you regex may have been syntactically wrong.

by Peter Karsai (ORF Team) 8 years ago
(in reply to this post)


Hmmm, then I think I'm doing something wrong and wouldn't mind some help. What I'm trying to do is to pick up any instances of the character { or } within a string. I've tried \({|}) and even broken them up \{ and \}. The first won't pick it up, and the latter will only pick up the characters if its at the beginning of the sample and not if its within.

by Kwan Lau 8 years ago



This means any characters, any number of repetitions, followed by either { or }, followed by any character, any number of repetitions.

by Krisztian Fekete (Vamsoft) 8 years ago

aha! Much thanks, looks like its working now.

by Kwan Lau 8 years ago

New comment

Fill in the form below to add a new comment. All fields are required. If you are a registered user on our site, please sign in first.

It will not be published.
hnp1 | hnp2