|
-
Jun 8th, 2008, 08:47 AM
#1
Thread Starter
Lively Member
[2008] Wildcards?
Well, what I'm looking for are 3 different wild cards I can use while searching a textbox.
Here's an example of what I need:
? Matches any single character at the position. For example, the expression "ABCDE" Like "AB?DE" returns True because it matches any character in the third position of the string as long as the remaining characters match exactly.
* Matches zero or more characters at the position. For example, the expression "ABCDE" Like "*CDE" returns True because it matches any characters at the beginning of the string followed by "CDE" at the end of the string. Likewise, "ABCDE" Like "AB*" returns True since the two strings begin with "AB" irrespective of any following characters. The expression "ABCDE" Like "*D*" returns True because the string contains "D" preceded and followed by any number of characters.
^ Matches zero or more integers at the position. For example, the expression "12345" Like "^345" returns True because it matches any integers at the beginning of the string followed by "345" at the end of the string. Likewise, "12345" Like "12^" returns True since the two strings begin with "12" irrespective of any following integers. The expression "12345" Like "*4*" returns True because the string contains "4" preceded and followed by any number of integers.
# Matches any single digit (0 - 9) at the position. For example, the expressions "12345" Like "12#45" and "12845" Like "12#45" return True because they match any decimal digit in the third position of the string as long as the remaining characters match exactly.
Please respond asap 
Thanks,
Alex
Last edited by Deathader; Jun 8th, 2008 at 07:06 PM.
-
Jun 8th, 2008, 12:17 PM
#2
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 8th, 2008, 12:19 PM
#3
Thread Starter
Lively Member
Re: [2008] Wildcards?
No, what I need is like:
Code:
if instr(textbox1.text, "11758##49#") then
listbox1.items.add("Found!")
end if
-
Jun 8th, 2008, 03:18 PM
#4
Addicted Member
Re: [2008] Wildcards?
 Originally Posted by Deathader
No, what I need is like:
Code:
if instr(textbox1.text, "11758##49#") then
listbox1.items.add("Found!")
end if
You'll want to use a regular expression.
-
Jun 8th, 2008, 03:56 PM
#5
Re: [2008] Wildcards?
 Originally Posted by joe1985
You'll want to use a regular expression.
how about an example?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 8th, 2008, 04:05 PM
#6
Addicted Member
Re: [2008] Wildcards?
 Originally Posted by .paul.
how about an example?
http://www.google.com/search?q=regular+expression
-
Jun 8th, 2008, 04:06 PM
#7
Thread Starter
Lively Member
Re: [2008] Wildcards?
 Originally Posted by joe1985
How would I use regex as a wild card?
-
Jun 8th, 2008, 04:33 PM
#8
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 8th, 2008, 07:00 PM
#9
Thread Starter
Lively Member
Re: [2008] Wildcards?
 Originally Posted by .paul.
edit
Do you mind giving me an example?
-
Jun 9th, 2008, 01:18 AM
#10
Re: [2008] Wildcards?
There are some examples here: http://www.regular-expressions.info/quickstart.html and I'd suggest taking a look at the Wrox book "beginning Javascript" which has a great chapter on regular expressions. They aren't for the feint of heart and knocking up a simple sample for your above problem isn't a 2 second job - it could turn into a few hours work and involve pulling lots of hair out!
-
Jun 9th, 2008, 04:18 AM
#11
Fanatic Member
Re: [2008] Wildcards?
 Originally Posted by Deathader
Well, what I'm looking for are 3 different wild cards I can use while searching a textbox.
Here's an example of what I need:
? Matches any single character at the position. For example, the expression "ABCDE" Like "AB?DE" returns True because it matches any character in the third position of the string as long as the remaining characters match exactly.
* Matches zero or more characters at the position. For example, the expression "ABCDE" Like "*CDE" returns True because it matches any characters at the beginning of the string followed by "CDE" at the end of the string. Likewise, "ABCDE" Like "AB*" returns True since the two strings begin with "AB" irrespective of any following characters. The expression "ABCDE" Like "*D*" returns True because the string contains "D" preceded and followed by any number of characters.
^ Matches zero or more integers at the position. For example, the expression "12345" Like "^345" returns True because it matches any integers at the beginning of the string followed by "345" at the end of the string. Likewise, "12345" Like "12^" returns True since the two strings begin with "12" irrespective of any following integers. The expression "12345" Like "*4*" returns True because the string contains "4" preceded and followed by any number of integers.
# Matches any single digit (0 - 9) at the position. For example, the expressions "12345" Like "12#45" and "12845" Like "12#45" return True because they match any decimal digit in the third position of the string as long as the remaining characters match exactly.
Please respond asap 
Thanks,
Alex
Though several other responses indicate using regex, in this case, you're probably better off using the Like operator. You should look it up in the vb help but it basically works like this:
"abc" Like "a*" = True
"abc" Like "a?" = False
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|