How to use RegEx to convert CRLF to LF?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
daniel347x
Newbie
Posts: 8
Joined: Tue Apr 26, 2011 9:41 pm

How to use RegEx to convert CRLF to LF?

Post by daniel347x » Wed Apr 27, 2011 5:20 pm

Hello -

I cannot figure out how to use MS to convert CRLF to LF throughout a string variable.

RegEx>(?m)%CRLF%,%mystring%,0,Matches,NumMatches,1,%LF%,mystring_result

... does not seem to work.

I can't find an answer browsing through the forums.

Any suggestions?

Thanks,
Dan.

EDIT: I am baffled by this, but:
RegEx>%CRLF%,%mystring%,0,Matches,NumMatches,1,%LF%,mystring_result
... now works. (The (?m) isn't necessary, but it works with it as well.

I am scratching my head as to why it didn't seem to work before. However, since it works now, I'm happy. Thanks
Last edited by daniel347x on Wed Apr 27, 2011 6:01 pm, edited 1 time in total.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Wed Apr 27, 2011 6:00 pm

Do you really need RegEx? or do you just need it to work?

This way works without using Regular Expressions

Code: Select all

StringReplace>SourceString,%CRLF%,%LF%,NewString

daniel347x
Newbie
Posts: 8
Joined: Tue Apr 26, 2011 9:41 pm

Thanks - it works now

Post by daniel347x » Wed Apr 27, 2011 6:04 pm

For some reason, it's working now. (Even using the RegEx)

I've appended an edit to my initial posting to say this.

Obviously, I did something different than is indicated here. I'm sorry for the false alarm - wish it hadn't cost me a couple hours, whatever I did wrong.

Thanks,
Dan.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts