infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Read Only Archives
Cloverleaf
Cloverleaf
Regsub - curly brace issue
Ray Mullen
Hi,
I have a translate that generates a hl7 message. Within the translate I have a few regsub commands that convert , to E | to F e.t.c and that works fine, however I have just encountered a problem when the user has entered a " { (Curly Brace) " into the message, it plays havoc with the regsub.
I prob need to replace the curly brace at the start, and then replace it back again before i release the message. I Have tried lots of different combinations but dont seem to be able to get the code to work, any one any ideas how to use regsub to replace a {.
Thanks in advance
Ray
Find more posts tagged with
Clovertech
Comments
System
Originally posted by John Hamilton
Are you looking for something like this
tcl>
tcl>set CURLY "This is a {CURLY TEST}
This is a {CURLY TEST} done
tcl>regsub -all "{" $CURLY "^$" STEP1
1
tcl>regsub -all "}" $STEP1 "$^" STEP2
1
tcl>echo $STEP2
This is a ^$CURLY TEST$^ done
tcl>
At least this should give you a start. I'm sure if I worked at it we could get both brackets at the same time.
Ray Mullen
Hi John , I have tried this code and it works fine from the command line but i can't seem to get it to work within a translate , I have the following example but when i run it through the testing tool it gives me an error
set c_output [lindex $xlateInVals 0]
set a $c_output
regsub -all "{" $a "^$" c_output
set xlateOutVals
Tom Rioux
Take this line: regsub -all "{" $a "^$" c_output
and change to: regsub -all "{" $a "^$" c_output
Once I added the backslash, it worked fine in my test Xlate.
Let me know how it works for you.
Thanks....
Tom Rioux
System
Originally posted by John Hamilton
That is correct with in the Xlate you need to escape out the curly brackets.
Also you may want to change "^$" "$^" to something a little more easy to deal with those both have special meaning and when you go to move the back to brackets it will be tough.
Maybe use "Cu_iN" and "Cu_ouT" or something with out special characters.
Ray Mullen
Thomas & John, thanks a million for you help , that worked just fine.
Ray
Charlie Bursell
This would be much simplier and more egonomic if you used the string map command.
tcl>
tcl>set CURLY "This is a {CURLY TEST}
set CURLY [string map
$CURLY]Regular expressions are powerful but not needed for every occasion.
Ray Mullen
Ok Charlie , will try that out, thanks for your reply, appreciate it
Ray