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: Trim text on the beginning
Topic Summary:
Created On: 09/15/2009 04:45 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.
 09/15/2009 04:45 AM
User is offline View Users Profile Print this message

Author Icon
GerhardWasner
Student (5-19 posts)

Posts: 6
Joined: 05/28/2008

Hi All,
I'm sure it will be easy but I don't find the answer in the forum:

I have to trim text. On the end and on the beginning.
With this it works to trim on the end:

<AMVARIABLE NAME="a">this is a very importand text</AMVARIABLE>
<AMVARIABLE NAME="b"></AMVARIABLE>
<AMREPLACE TEXT="%a%" FIND="very.*" RESULTVARIABLE="b" USERE="YES" USEENHANCEDRE="NO">

But how can I trim the text on the beginning? Lets say I want this result:
"very importand text".

Importand: the text change sometimes, so I can not looking for the string "this is a " and delete them. I have to looking for one specified word and delete all in front of this word.
Thanks a lot for each help!
Gerhard



 Category Survey
 09/15/2009 06:25 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Gerhard,
here is one of many solutions.

 Category Survey
AutoMate 6 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 09/15/2009 07:28 PM
User is offline View Users Profile Print this message

Author Icon
GerhardWasner
Student (5-19 posts)

Posts: 6
Joined: 05/28/2008

Thanks Jean, works perfekt!



 Category Survey
 09/15/2009 11:50 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

You're welcome, Gerhard

 Category Survey
AutoMate 6 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
 10/17/2013 10:19 AM
User is offline View Users Profile Print this message

Author Icon
Poshiden
Apprentice (20-49)

Posts: 38
Joined: 01/08/2013

My partner in crime helped me come up with a solution that got the opposite of what Jean got with his (everything after the very)

 

Wanted to share in case it helped anyone else:

 



 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)
 10/17/2013 10:20 AM
User is offline View Users Profile Print this message

Author Icon
Ricardo Castaneda
HelpSystems

Posts: 3424
Joined: 01/11/2008

Hi Poshiden,

Thank you for the follow up.

 Category Survey


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

Ricardo Castaneda | Principal Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700
 10/17/2013 11:51 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Poshiden,
your solution is OK
There is another one which capitalizes on InStrRev function (In String Reverse) :
%Mid(a,InStrRev(a,"very")-4)%
Which yields a comparable result, provided "very" appears only once in the text

BTW your solution does not return the character following immediately "very" while mine does.

 Category Survey
AutoMate 6 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


Edited: 10/17/2013 at 11:57 AM by JeanDelfosse
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 3766 guests browsing this forum, which makes a total of 3766 users using this forum.

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

Sitemap Network Automation Software Blog