Jump to content

StringRegexp


Recommended Posts

Dear All.

I have as below strings in .txt file

+---------------------------------------------------------------------------+
|                       AMIDEWIN32 Utility v5.19.0015                       |
|      Copyright (C)2017 American Megatrends Inc. All Rights Reserved.      |
+---------------------------------------------------------------------------+

Initializing the SMBIOS interface.  Please wait a moment......
          Name              R/W  Status  Information
--------------------------  ---  ------  ----------------------------------
(/BP)Baseboard product       R    Done   "36E0"
 

 

And I want to get "36E0" String with StringRegExp($String, '"[A-Za-z0-9\"]+' , 3)

But can't get this string , someone can help me?

Link to comment
Share on other sites

welp...given that, the easiest way is:

$s = '+---------------------------------------------------------------------------+' & @CRLF & _
' |                       AMIDEWIN32 Utility v5.19.0015                       |' & @CRLF & _
' |      Copyright (C)2017 American Megatrends Inc. All Rights Reserved.      |' & @CRLF & _
' +---------------------------------------------------------------------------+ ' & @CRLF & _
'' & @CRLF & _
'Initializing the SMBIOS interface.  Please wait a moment......' & @CRLF & _
'           Name              R/W  Status  Information' & @CRLF & _
'--------------------------  ---  ------  ----------------------------------' & @CRLF & _
'(/BP)Baseboard product       R    Done   "36E0"'

$a = StringRegExp($s,'\"(.*)\"',3)

But I would think you want to get the value based on the name...so maybe

$a = StringRegExp($s,'Baseboard product.*\"(.*)\"',3)

??

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

My go at it:

 

#Include <Array.au3>

$s = '+---------------------------------------------------------------------------+' & @CRLF & _
' |                       AMIDEWIN32 Utility v5.19.0015                       |' & @CRLF & _
' |      Copyright (C)2017 American Megatrends Inc. All Rights Reserved.      |' & @CRLF & _
' +---------------------------------------------------------------------------+ ' & @CRLF & _
'' & @CRLF & _
'Initializing the SMBIOS interface.  Please wait a moment......' & @CRLF & _
'           Name              R/W  Status  Information' & @CRLF & _
'--------------------------  ---  ------  ----------------------------------' & @CRLF & _
'(/BP)Baseboard product       R    Done   "36E0"'

$a = StringRegExp($s, '(?i)Done\s*\x22([^\x22]*)', 3)

_ArrayDisplay($a)

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...