hiteksoftware.com Forum Index hiteksoftware.com
User discussion forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to insert line enders with Regex

 
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Frequently Asked Questions
View previous topic :: View next topic  
Author Message
ajharn



Joined: 30 Mar 2007
Posts: 56

PostPosted: Tue Jun 23, 2009 9:26 am    Post subject: How to insert line enders with Regex Reply with quote

Hi,

I'm trying to take a "Filenames" variable from a File Monitor task and strip out the ^# separating each filename and replace it with a CR/LF so I can dump the variable to a list in a text file that is user friendly.

I am using the manipulate variable task and I am searching for \^# and replacing with \r\n. It does not work, it simply inserts a literal "r" & "n" in the text in place of the ^#. I have also tried double escapes "\\r\\n" and I have tried using regex to insert ASCII chars \x0d\x0a. All of these simply end up inserting literals. It doesn't look like Automize accepts these particular Regex commands. Please let me know if I can accomplish inserting line enders into a variable with Automize.

I noticed this had been brought up once before in the forums but not resolved:
http://www.hiteksoftware.com/phpBB2/viewtopic.php?t=2077&highlight=carriage+return

Thanks for your help.
Back to top
View user's profile Send private message
melvin
Site Admin


Joined: 25 May 2006
Posts: 635
Location: Santa Barbara, california

PostPosted: Tue Jun 23, 2009 7:59 pm    Post subject: Reply with quote

Unfortunately, this is not possible since all the variables are single line variables.
your best bet would be to replace by , or by spaces.
Back to top
View user's profile Send private message Send e-mail
ajharn



Joined: 30 Mar 2007
Posts: 56

PostPosted: Wed Jun 24, 2009 7:50 am    Post subject: Reply with quote

Thanks, Melvin.

I had a feeling this might be the case with variables. I will go another route.
Back to top
View user's profile Send private message
ajharn



Joined: 30 Mar 2007
Posts: 56

PostPosted: Wed Jun 24, 2009 8:20 am    Post subject: Reply with quote

Just out of curiosity, how does the Replace function in the Text Search task work? It is not documented in the help for that task. It looks like that task type is addressing the text directly (not in variables). Is it possible to insert a line ender using the replace function in this task?

I.E.
1) I can use file variable to output the FileNames result I need to a file.
2) Use TextSearch to replace the ^# occurrences in that file with line enders.

Possible?

If not, please throw this on the feature request list.

Thanks.
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Wed Jun 24, 2009 7:35 pm    Post subject: Reply with quote

The text search task will behave the same way. i.e. it cannot write a newline. It will write \r\n or other characters only.
Back to top
View user's profile Send private message
ajharn



Joined: 30 Mar 2007
Posts: 56

PostPosted: Thu Jun 25, 2009 11:38 am    Post subject: Reply with quote

UPDATE

This was an Outlook issue and I solved it. Cheers.

-------------------------------

Related follow-up on this.

I went ahead and coded in VB the process to find the "^#" in the output file and convert it to line enders. It works fine.

So in the resulting file, I now have one item per line instead of one long line separating each item with "^#".

However, when I e-mail the resulting text file using an Automize Send Mail task and using the $$$c:\folder\Filename.txt method to dump the file into the e-mail, the Line Enders are removed again.

So, if I look at the source file in a hex editor, I indeed have an 0x0D and 0x0A at the end of each line, but when I send it via Automize, those line enders are removed.

I have also noticed that if I cut and paste the text file into an Outlook e-mail set in "plain text" mode, the same thing happens. Also of note, the header of the text file, which I created manually in a text editor has a couple of different lines and the line enders are NOT removed from that when e-mailing it. But again, if I look at this file in hex mode, the line enders on those lines are no different from the line enders I inserted with VB.

Any idea what gives with this?

Thanks,
AJ
Back to top
View user's profile Send private message
melvin
Site Admin


Joined: 25 May 2006
Posts: 635
Location: Santa Barbara, california

PostPosted: Sun Jun 28, 2009 9:08 pm    Post subject: Reply with quote

I have no clue on line enders, but one thing you can do to debug:
1) Create a text file using notepad (and or wordpad) with multiple lines.
send it via Automize . it should work I guess.
2) look up this text file using your hex editor and see what are the line enders here, and then try to get these line enders.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Frequently Asked Questions All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group