Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: regular expression: multiline negative lookahead (regexp)
Topic Summary: how to make the . include linebreak in automate regex?
Created On: 02/04/2014 07:41 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 02/04/2014 07:41 AM
User is offline View Users Profile Print this message

Author Icon
SanderTermaat
n00b (>6 posts)

Posts: 2
Joined: 09/04/2013

Hi all,

I'm trying to have automate correct faulty inputfiles for a batch process. I know a little about regular expressions, but am in no way a master.

At the moment I do this 'by hand' in notepad++ using the following two regular expressions:

\{1\:(?!.*\{1:).*     -> finds the last record in the file, and I manually delete this record.

(:62M:)(?!.*:62M:)    -> finds the last :62M: tag, and I replace this with :62F:

 

My problem is this: in notepad++ I can set an option that the . includes linebreaks (\r\n in my case). I can't find the option to do this in automate?

I found online the switch (?p) or (?m) which should enable this behaviour, but autoamte tells me it is invalid regexp.

 

Anybody know how to do is, or how to work around it?

 

Sample input file:



 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)
 02/04/2014 01:28 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Sander,
this is a known deficiency of AutoMate regexes.
As a workaround I would suggest that you temporarily replace all \r\n (%vbCrLf%) in the variable with some special character absent from the file (e.g. µ) which will transform the whole file into a single line.
Then apply your regexes
Then replace the µ's with %vbCrLf% to restore the line breaks.

 Category Survey
AutoMate 8 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 02/05/2014 04:38 AM
User is offline View Users Profile Print this message

Author Icon
SanderTermaat
n00b (>6 posts)

Posts: 2
Joined: 09/04/2013

Jean, 

Thanks a lot! I actually saw this solution on the forums before, but somehow I didn't see that it was applicable to my problem as well.

 

It works perfectly now.

 

Thanks again for the swift respond.



 Category Survey


Edited: 02/05/2014 at 05:34 AM by SanderTermaat
 02/05/2014 06:57 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

You're welcome, Sander

 Category Survey
AutoMate 8 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 772 guests browsing this forum, which makes a total of 772 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog