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
Regular Expression Help
Keith McLeod
I need to replace either pattern in OBX:5. Since this comes from different/many labs systems, I need it to work on either possibility.
search for E.brE or .br and replace each occurence with ~.
The .br expression works fairly easily but not having much luck on the E.brE expression.
Find more posts tagged with
Clovertech
Comments
david_barr
The patterns should be \E\.br\E\ and \.br\, but you can use (\E\.br\E\|\.br\) to match either one.
If someone is sending you E.brE then they are doing something wrong.
Keith McLeod
I would believe that what you sent would work, but this is what I get when actually using it.
regsub -all {(\E\.br\E\|\.br\)} $xlateInVals {~} xlateOutVals
E~E for the one with E contained in it, but works on the .br as you can see it replaced that pattern in the middle of the string.
If I remove the |\.br\
david_barr
You should probably replace $xlateInVals with [lindex $xlateInVals 0] seeing as how it's a list being passed to a command that expects a string. I'm not sure if that's the cause of the problem. Have you tried echoing out $xlateInVals to see what it looks like?
Keith McLeod
Tried both of those. No luck on it as of yet.
Charlie Bursell
I would try string map
First map all instances of .br to ~ and then all instances of E to ""
To make sure of the order do like
set inp [string map
[lindex $xlateInVals 0]]set xlateOutVals [list [string map
$inp]]
Keith McLeod
Here is what I ended up with so far until I can break it.
regsub -all {([\]+E[\]+.br[\]+E[\]+|\.br\)} [lindex $xlateInVals 0] {~} obx_5
set xlateOutVals
I may try Charlies as well and see how that goes...