HackLife
asked on
vbscript regular expressions: I need to find a string that starts with asdfj= but not inclusive...
I need to find a string that starts with asdfj= but not inclusive...
basically, i need everything that follows asdfj=
basically, i need everything that follows asdfj=
ASKER
I would have to loop to find multiple instances. I wonder which one is faster.
ASKER
it's multiple instances: for example:
asdfj=lskdjfasldkfj;asldkf jdslfkjlas kdjflskdjf lksjdfkldj f;asdfj=jo hakcliekkd kdkdkdkdkd kkdkdkdkdk ;asdf=keke kekekeke;
asdfj=lskdjfasldkfj;asldkf
(asdfj=)([\w]+)
The parenthesis will separate this expression into 2 groups. In that way you can find a match, and look at the group portion that you need.
Bob
The parenthesis will separate this expression into 2 groups. In that way you can find a match, and look at the group portion that you need.
Bob
ASKER
The parenthesis are not working and the contents have colons, periods, newlines and such, so the \w does not work here. Thanks
Can you give me an example to test?
Bob
Bob
ASKER
I've been using
The pattern = "asdfj=[^;""]*"
Right(Match, Len(Match) - Len("asdfj=")) to solve this problem.
It would be nice to combine the two into on pattern.
You can see the pattern above and what i'm looking for. Everything except semicolon and doublequotes.
The pattern = "asdfj=[^;""]*"
Right(Match, Len(Match) - Len("asdfj=")) to solve this problem.
It would be nice to combine the two into on pattern.
You can see the pattern above and what i'm looking for. Everything except semicolon and doublequotes.
Do you have some text that I can test an expression with?
Bob
Bob
ASKER
I'm new to this pattern stuff, so I don't know what is a good switch if any to remove the "asdfj=" from the list of matches.
Also, what are you working on? There might be a different way versus using regular expressions.
Bob
Bob
ASKER
The information maybe classified, so I can't give you specific data.
I got my script to do what I need. I just want to do that which is mentioned above more effieciently. Instead of an expression and a left(text, instr()), I'd rather just do an expression. There is no other better way than expression because the CSV files i'm parsing are 100k and up, very very large. I tested it with csv database connections and instr() mid() and array loops. All are much much slower. Timed them using timer.
So, all I want to know is, is there are way to pull the asdfj=whatever;asdfj=again whatever; without including the asdfj= string in the match, and without using right(text, len(text) - len(asdfj=))
I got my script to do what I need. I just want to do that which is mentioned above more effieciently. Instead of an expression and a left(text, instr()), I'd rather just do an expression. There is no other better way than expression because the CSV files i'm parsing are 100k and up, very very large. I tested it with csv database connections and instr() mid() and array loops. All are much much slower. Timed them using timer.
So, all I want to know is, is there are way to pull the asdfj=whatever;asdfj=again
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Dim strText
Dim strSubText
Dim nPtr
strText = 'The lazy dog jumped over asdfj=the sleeping cat"
nPtr = Instr(strText,"asdfj=")
If nPtr > 0 Then
strSubText = Mid(strText,nPtr + 6)
End If
strSubText will contain "the sleeping cat" at the end of this execution.
HTH,
Lynn