RegEx : ReplaceRegularExpression

Just starting out? Need help? Post your questions and find answers here.
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

RegEx : ReplaceRegularExpression

Post by Progi1984 »

I try to learn to use the new regex but i just fall on a problem

Why doesn't this code run ?

Code: Select all

String.s = "Hier ist eine Demo wie aus dem BB-Code "
String   + "[URL=http://www.google.de]Google[/url] "
String   + "oder diesem hier "
String   + "[url=http://www.pure-board.de]Pure-Board[/URL] "
String   + "ein HTML-Code wird."

If CreateRegularExpression(1, "(?i)\[URL=([^\[\]]+)\]([^\[\]]+)\[/URL\]")
  Result.s = ReplaceRegularExpression(1, String, "<a href='?1'>\\2</a>")
Else
  Result.s = RegularExpressionError()
EndIf

String2.s = "\pard\qc  \pard\qd \pard\qr \pard\qs \pard\qj"

If CreateRegularExpression(2, "\\pard\\q[crj]")
  Result2.s = ReplaceRegularExpression(2, String2, "<newpar \\1>")
Else
  Result2.s = RegularExpressionError()
EndIf

Debug Result
Debug Result2
Thanks for advance !
User avatar
hallodri
Enthusiast
Enthusiast
Posts: 208
Joined: Tue Nov 08, 2005 7:59 am
Location: Germany
Contact:

Post by hallodri »

PB has no support for groups.
Post Reply