473,383 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Wildcard String Search

Hello

I'm trying to search for each instance of a string (using wildcards) in another string. I know there is the Like operator, but it seems to be work with booleans and I want to define a string variable.

I tried strPdfFileName = strPdfFileName Like "########.pdf"

I'm sure there's a better string methd to better accomplish what I'm doing here.

Thans in advance - Cliff
Function ExtractPdfFileNames(ByVal strSourceText As String) As ArrayList

Dim arrFoundPdfFileNames As New ArrayList()
Dim strPdfFileName As String

'define what a pdf filename looks like
strPdfFileName = 'here is where I want to define ".pdf" and 8 digits to the left (i.e. "13567849.pdf") _
or even any word ending in ".pdf"

'copy pdf filenames from source text into arraylist
For Each strPdfFileName In strSourceText
arrFoundPdfFileNames.Add(strPdfFileName)
Next

'return the results
Return arrFoundPdfFileNames

End Function

Nov 20 '05 #1
4 3303
Cor
Hi Cliff,

Have a look at the regular expressions for that

http://msdn.microsoft.com/library/de...xpressions.asp

I hope this helps

Cor
Nov 20 '05 #2
Please don't post in HTML format!

Regards,
Herfried
--
Herfried K. Wagner
Microsoft MVP
Nov 20 '05 #3
Please don't post in HTML format!

Regards,
Herfried
--
Herfried K. Wagner
Microsoft MVP
Nov 20 '05 #4
Thanks for the help, but I must be totally dense. I tried working with the
MSDN example below, but the Capture Class example seemed way too complicated
for my needs. i.e. I couldn't decipher:

Dim pat As String = "(?<1>\w+)\s+(?<2>fish)\s*"

I don't know if anyone can give me a really simple example from my original
code below.

Thank you! - Cliff
"Cor" <no*@non.com> wrote in message
news:e2**************@TK2MSFTNGP12.phx.gbl...
Hi Cliff,

Have a look at the regular expressions for that

http://msdn.microsoft.com/library/de...xpressions.asp
I hope this helps

Cor

"Cliff" <sw*****@hotmail.com> wrote in message
news:Ak4Ub.3062$G74.746@clgrps13...
Hello

I'm trying to search for each instance of a string (using wildcards) in
another string. I know there is the Like operator, but it seems to be work
with Booleans and I want to define a string variable.

I tried strPdfFileName = strPdfFileName Like "########.pdf"

I'm sure there's a better string methd to better accomplish what I'm doing
here.

Thanks in advance - Cliff
Function ExtractPdfFileNames(ByVal strSourceText As String) As ArrayList

Dim arrFoundPdfFileNames As New ArrayList()
Dim strPdfFileName As String

'define what a pdf filename looks like
strPdfFileName = 'here is where I want to define ".pdf" and 8 digits
to the left (i.e. "13567849.pdf") _
or even any word ending in ".pdf"

'copy pdf filenames from source text into arraylist
For Each strPdfFileName In strSourceText
arrFoundPdfFileNames.Add(strPdfFileName)
Next
'return the results
Return arrFoundPdfFileNames

End Function
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Generic Usenet Account | last post by:
Here's the requirement that I am trying to satisfy: Handle wildcards in STL such that the wildcard entry is encountered before non-wildcard entries while traversing containers like sets and...
1
by: deko | last post by:
I have a form where users can enter a string with asterisks to perform a wildcard search. Currently, the string entered by the user looks like this: *somestring* The purpose is to match any...
2
by: deko | last post by:
I'm trying to use a textbox to search and display records as each letter is typed in - similar to the behavior of a combo box. But for some reason I can't seem to get the wildcard search character...
2
by: RobC | last post by:
I have noticed that in the directoryInfo class a method named GetFiles(String) accepts a wildcard pattern as a parameter and uses this to match file names that exist in a directory. I want to use...
1
by: JemPower | last post by:
Hi all, Can someone tell me if it's possible to search through a dataview based on a part-filter. For example, if I use... Dim dvAvailable = New DataView(dsRecipients.Tables("Available"),...
2
by: JohnT | last post by:
Okay... I'm using VB.net (2003) and I am accessing an MS Access DB file. I have two DataAdapters that I use to search for specific info. The two of them are similar except one is a Date, the...
3
by: george.lengel | last post by:
Hello experts, I have been struggling for days to solve this problem and every suggestion I find via Google does not work for me. There is probably a solution out there that will do what I want,...
2
by: googlegroups.dsbl | last post by:
I'm really confused here, and am wondering if someone knows what could be the issue with my TableAdapter query. A few months ago, I created a really neat program that has th ability to search by...
2
by: Arch Stanton | last post by:
I have an aspx page with a text box. My user enters text to search for and presses a button; the text is passed via a QueryString to another aspx page and used in a SQL search. The wildcard...
0
by: savage678 | last post by:
Hi Everyone, I am new to this forum and am i dire need of some help. I am trying to use wildcard searches in infopath. I have it connected to an access database using data connection. I have...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.