Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reg Ex help

Posted on 2013-01-15
6
Medium Priority
?
194 Views
Last Modified: 2013-01-15
Hi there,

need to pull some text out of hte following string:

{1:F01ABCDEFGHAXXX0000000000}{2:I101HSBFREDXXXXN}{4:|13||10|

Basically, I need to return the 8th character for a length of 11 whenever there is {2:

So for example:

from the above string i need to return HSBFREDXXXX
0
Comment
Question by:Wayne Atherton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38777999
Depending on what language you are using, you might be able to use:

(?<=\{2:.{4}).{11}

Open in new window


...though, I honestly don't think you need a regex for this task.
0
 
LVL 1

Author Comment

by:Wayne Atherton
ID: 38778011
hi kaufmed,

I am using VBScript.

I need the regex, because the value isn't always in the same place, so i need to find it based on {2:
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 total points
ID: 38778069
because the value isn't always in the same place, so i need to find it based on {2:
Still don't think you need a regex  ; )

targetString = "{1:F01ABCDEFGHAXXX0000000000}{2:I101HSBFREDXXXXN}{4:|13||10|"
sentinel = "{2:"
startOf = InStr(targetString, sentinel)

If startOf > 0 Then
    toFind = Mid(targetString, startOf + 7, 11)
End If

MsgBox toFind

Open in new window

0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 1

Author Comment

by:Wayne Atherton
ID: 38778130
i've put this into a Function, and pass the string and sentinal in as params, but it returns nothing

strIn = Objects("InputString").text
strTy = Objects("SearchString").text

 Function MTMessage(strIn,strTy)

    startOf = InStr(strIn, strTy)

    If startOf > 0 Then
    strTy = Mid(strIn, startOf + 7, 11)
    End If

 End Function
   Objects("OutputString").text = MTMessage(strIn,strTy)
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 2000 total points
ID: 38778237
You're not returning anything from the function.
0
 
LVL 1

Author Closing Comment

by:Wayne Atherton
ID: 38778483
cheers
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question