Sign in to follow this  
Followers 0
jefhal

StringRegExpReplace works differently

12 posts in this topic

#1 ·  Posted (edited)

I'm having a problem with StringRegExpReplace, where it used to work fine with my last version of AutoIT3 (3.1.1.126), but with 3.2.2, it does not:

Input string (from an array):

[11]    = Adobe Bridge 1.0  Bridge  001.000.004 Adobe Systems   Adobe Bridge    No  Yes C:\Program Files\Adobe\Adobe Bridge http://www.adobe.com    2/8/2007 1:38:31 PM MsiExec.exe /I{B74D4E10-6884-0000-0000-000000000103}    No  {B74D4E10-6884-0000-0000-000000000103}  Windows Installer   HKEY_LOCAL_MACHINE

$1 = StringLeft($arSoftware[$i],StringInStr($arSoftware[$i],@TAB,0,3))
    $2 = StringRegExpReplace($1,'\t*?.*?\t'," version: ")

Correct output:

Adobe Bridge 1.0 version: 001.000.004

What I get with 3.2.2:

version:  version:  version:

Can anyone tell me why this stopped working? Thanks, :whistle:

Edited by jefhal

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites



I'm having a problem with StringRegExpReplace, where it used to work fine with my last version of AutoIT3, but with 3.2.2, it does not:

$1 = StringLeft($arSoftware[$i],StringInStr($arSoftware[$i],@TAB,0,3))
    $2 = StringRegExpReplace($1,'\t*?.*?\t'," version: ")

Can anyone tell me why this stopped working? Thanks, :whistle:

Are we supposed to guess what the string is?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Are we supposed to guess what version of AutoIt your "last" version is? How about you read the changelog for AutoIt instead of blindly upgrading?

Share this post


Link to post
Share on other sites

Are we supposed to guess what version of AutoIt your "last" version is? How about you read the changelog for AutoIt instead of blindly upgrading?

Valik, blindly upgrading is the only risk I have left in my life!

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

Are we supposed to guess what the string is?

Please see corrected post...

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

Valik, blindly upgrading is the only risk I have left in my life!

:whistle:

I'm taking a shot in the dark... and assuming this is what you are trying. I would have liked to of seen the actual string and what you "expected" the outcome to be.

$1 = "              abcdeslkajd "
    $2 = StringRegExpReplace($1,'^(\t*.*?\t)'," version: ")
    MsgBox(0, '', $2)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Valik, blindly upgrading is the only risk I have left in my life!

That's why, with time, I know I'll really learn to love the Office ribbon...

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

:whistle:

I'm taking a shot in the dark... and assuming this is what you are trying. I would have liked to of seen the actual string and what you "expected" the outcome to be.

$1 = "              abcdeslkajd "
    $2 = StringRegExpReplace($1,'^(\t*.*?\t)'," version: ")
    MsgBox(0, '', $2)
That gives me:

version: Bridge 001.000.004

I have edited my original message with a sample of the real input...

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

That gives me: I have edited my original message with a sample of the real input...

I attempted to use your example... I'm getting a blank string for $1.

Dim $arSoftware[12]
$arSoftware[11] = "Adobe Bridge 1.0    Bridge    001.000.004    Adobe Systems    Adobe Bridge    No    Yes    C:\Program Files\Adobe\Adobe Bridge    http://www.adobe.com    2/8/2007 1:38:31 PM    MsiExec.exe /I{B74D4E10-6884-0000-0000-000000000103}    No    {B74D4E10-6884-0000-0000-000000000103}    Windows Installer    HKEY_LOCAL_MACHINE"
    $1 = StringLeft($arSoftware[11],StringInStr($arSoftware[11],@TAB,0,3))
    MsgBox(0, '', $1)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

$2 = StringRegExpReplace($1,'\t+.*?\t+'," version: ")


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

I attempted to use your example... I'm getting a blank string for $1.

Hi SmOke_N- I think you're getting an empty string due to the loss of the tab characters in copying and pasting them from my _arrayDisplay to this forum. However, thanks to your lead, I did get this to work:
$2 = StringRegExpReplace($1,'^<\t*?.*?\t>'," version: ")
Sleep(25)

This gives me the correct reply string and gives the next command enough time to absorb the result. Thank you!


...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

$2 = StringRegExpReplace($1,'\t+.*?\t+'," version: ")
With one change:

$2 = StringRegExpReplace($1,'\t.*?\t+'," version: ")

As I want exactly one tab, then any text (if exists), then all tabs to end of line. Thanks again SmOke_N, and I apologize for not first reading your message footer. Could be: "put mind in gear before engaging mouth (or fingers on keyboard)..."


...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0