Regex.Replace - what pattern to use

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Input: AVG(PE/12345(P)*67893(PH))
Output expected: AVG(PE/12345(ReplacedText)*67893(PH))
What should be the patter to use??

Also:

Input: AVG(PE/12345(PE))
Output: AVG(ReplacedText/12345(PE))

In above case - I want to replace PE only if it doesn't preceded with "#(" -
is this possible and what pattern should I use??

Is there a guide or website link which would explain little more about
patterns to use in regex (replace method)??

Thanks
UK.
 
Regex is great for pattern matching, but for a simple replace, why not just
use the "Replace" function?

The first one may be something like

// AverageData = AVG(PE/12345(PE))
AverageData = AverageData.Replace ( "(PE/", "(<new text>/" );
// AverageData = AVG(<new text>/12345(PE))
 
Back
Top