Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

253
Views
Regex formula - cannot recognize formula

I'm trying to write pattern to recognize formula IF form string.

e.g. string

[@param_6@]  @IF(@param_5@==null;@param_5@;@IF(1==1;@param_2@;@param_4@)@)@ - @param_3@ - <@IF(@parameter_tag2@ == null;@param_4@;@param_5@)@>

I want to obtain this result

1. Match: @IF(@param_5@==null;@param_5@;@IF(1==1;@param_2@;@param_4@)@)@
2. Match: @IF(@parameter_tag2@ == null;@param_4@;@param_5@)@

My pattern look like:

@IF\(.*\;.*\;.*\)@

But regex return me wrong result.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use

(?s)@IF\((?>(?!@IF\(|\)@).|(?<o>)@IF\(|(?<-o>)\)@)*\)@

See the regex demo. Details:

  • (?s) - RegexOptions.Singleline equivalent, . now matches LF chars, too
  • @IF\( - a @IF( string
  • (?>(?!@IF\(|\)@).|(?<o>)@IF\(|(?<-o>)\)@)* - zero or more repetitions of
    • (?!@IF\(|\)@).| - any char that does not start a @IF( or )@ char sequence
    • (?<o>)@IF\(| - a @IF( substring and a value is pushed on to the "o" group stack, or
    • (?<-o>)\)@ - a )@ string and a value is popped from the "o" group stack
  • \)@ - a )@ string
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!