473,395 Members | 1,474 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,395 software developers and data experts.

Challenge: Match a string in a file path

Hi All,

I have quite a unique issue - I would be very grateful if someone
could help out with this challenge....
I have two columns, Column A contains and acronym, and Column B
contains a corresponding file path. Like below:
Column A
FSSC
GPM SBU
AL ACT
.....
Column B
/_op_sox/Project/Default/ICDocumentation/Controls/LSSB/ITO/GPM/FSSC/
ADM-E-R001-C001.txt
/_op_sox/Project/Default/ICDocumentation/Controls/LSSB/ITO/GPM/GPM
SBU/
ADM-I-R003-R001.txt
/_op_sox/Project/Default/ICDocumentation/Controls/LSSB/II/AL/AL ACT/
ALV-A-R001-C001.txt
....
The 9th folder in the file path matches the acronym in column A, but
only 90% of the time. I have around 3000 rows and I need to highlight
which ones don't match the acronym in column A. Basically, what I
want
to do, is chop off everything before 9th "\" and everything after the
10th "\" and see if it matches column A - can anyone solve this
challenge?
Thank you so much!
Regards,
Tariq

Feb 8 '07 #1
5 1942
On Feb 8, 5:17 am, "Tawreq" <taw...@gmail.comwrote:
Hi All,

I have quite a unique issue - I would be very grateful if someone
could help out with this challenge....

I have two columns, Column A contains and acronym, and Column B
contains a corresponding file path. Like below:

Column A
FSSC
GPM SBU
AL ACT
....

Column B
/_op_sox/Project/Default/ICDocumentation/Controls/LSSB/ITO/GPM/FSSC/
ADM-E-R001-C001.txt

/_op_sox/Project/Default/ICDocumentation/Controls/LSSB/ITO/GPM/GPM
SBU/
ADM-I-R003-R001.txt

/_op_sox/Project/Default/ICDocumentation/Controls/LSSB/II/AL/AL ACT/
ALV-A-R001-C001.txt

...

The 9th folder in the file path matches the acronym in column A, but
only 90% of the time. I have around 3000 rows and I need to highlight
which ones don't match the acronym in column A. Basically, what I
want
to do, is chop off everything before 9th "\" and everything after the
10th "\" and see if it matches column A - can anyone solve this
challenge?

Thank you so much!

Regards,
Tariq

I don't have much time to spend on it, but here's one that works with
at least 2 "/" above the file. You'll have to modify it if you need to
allow for any path (not just 9 folder in) - and if a different
delimiter is used ( \ instead of /). It will currently fail if the
path is not in the same format as you posted.
After modifying it to meet your needs, this should always give you the
last listed folder (probably better than relying on it to always be
the 9th). Use it in a qry and compare the output with ColumnA.

Function GetLastFolder(pth As String) As String
On Error GoTo stoprun
GetLastFolder = ""
Dim a As Long
Dim pos As Long
Dim slshLocs() As Long
Dim lenFldr As Long

a = 0
pos = 1
Do Until pos = 0
pos = InStr(pos, pth, "/")
If pos <0 Then
ReDim Preserve slshLocs(a)
slshLocs(a) = pos
a = a + 1
pos = pos + 1
End If
Loop

If UBound(slshLocs) >= 1 Then
a = UBound(slshLocs)
pos = UBound(slshLocs) - 1
lenFldr = slshLocs(a) - slshLocs(pos) - 1
GetLastFolder = Mid(pth, slshLocs(pos) + 1, lenFldr)
End If

exit_here:
Exit Function

stoprun:
MsgBox Err.Number & " - " & Err.Description
Resume exit_here
End Function

Feb 8 '07 #2
"Tawreq" <ta****@gmail.comwrote in news:1170929879.301819.284220
@m58g2000cwm.googlegroups.com:
Hi All,
I have quite a unique issue - I would be very grateful if someone
could help out with this challenge....
I have two columns, Column A contains and acronym, and Column B
contains a corresponding file path. Like below:

Column A
FSSC
GPM SBU
AL ACT
....
Column B
/_op_sox/Project/Default/ICDocumentation/Controls/LSSB/ITO/GPM/FSSC/
ADM-E-R001-C001.txt
/_op_sox/Project/Default/ICDocumentation/Controls/LSSB/ITO/GPM/GPM
SBU/
ADM-I-R003-R001.txt

/_op_sox/Project/Default/ICDocumentation/Controls/LSSB/II/AL/AL ACT/
ALV-A-R001-C001.txt

The 9th folder in the file path matches the acronym in column A, but
only 90% of the time. I have around 3000 rows and I need to highlight
which ones don't match the acronym in column A. Basically, what I
want
to do, is chop off everything before 9th "\" and everything after the
10th "\" and see if it matches column A - can anyone solve this
challenge?
Test

ColumnA = Split(ColumnB, "/")(9)

Feb 8 '07 #3
Tawreq wrote:
>I have quite a unique issue - I would be very grateful if someone
could help out with this challenge....

I have two columns, Column A contains and acronym, and Column B
contains a corresponding file path. Like below:

Column A
FSSC
GPM SBU

Column B
/_op_sox/Project/Default/ICDocumentation/Controls/LSSB/ITO/GPM/FSSC/
ADM-E-R001-C001.txt

/_op_sox/Project/Default/ICDocumentation/Controls/LSSB/ITO/GPM/GPM
SBU/ADM-I-R003-R001.txt

The 9th folder in the file path matches the acronym in column A, but
only 90% of the time. I have around 3000 rows and I need to highlight
which ones don't match the acronym in column A. Basically, what I
want
to do, is chop off everything before 9th "\" and everything after the
10th "\" and see if it matches column A - can anyone solve this
challenge?
I like Lyle's idea, but another way could be the criteria:

Like "*\*\*\*\*\*\*\*\*\" & columnA & "\*"

--
Marsh
Feb 8 '07 #4
Test

ColumnA = Split(ColumnB, "/")(9)
I feel dumb for asking, but where does Split come from?
I've never seen this before.

Feb 9 '07 #5
On Feb 8, 9:53 pm, "storrboy" <storr...@sympatico.cawrote:
Test
ColumnA = Split(ColumnB, "/")(9)

I feel dumb for asking, but where does Split come from?
I've never seen this before.
Split was introduced in Access 2000. I believe it existed in VB
previously, but not in VBA.
Of course, many similar UDFs were created and published for use in
Access 97 and previous versions.

Feb 9 '07 #6

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

Similar topics

9
by: Steve | last post by:
Hello, I am writing a script that calls a URL and reads the resulting HTML into a function that strips out everthing and returns ONLY the links, this is so that I can build a link index of various...
9
by: Ron Adam | last post by:
Is it possible to match a string to regular expression pattern instead of the other way around? For example, instead of finding a match within a string, I want to find out, (pass or fail), if...
9
by: Stuart | last post by:
Hi All, I got a challenge to make the same APS/Script/Html run on different web roots. I can not use relative pathing in a lot of cases. We use lots of included files so depending on where that...
6
by: Ronald | last post by:
Hi there, I would like to challenge you all to make the fastest tally-function possible. The function should count the number of times a specified string is present within another string. As I'm...
7
by: Patient Guy | last post by:
Coding patterns for regular expressions is completely unintuitive, as far as I can see. I have been trying to write script that produces an array of attribute components within an HTML element. ...
78
by: wkehowski | last post by:
The python code below generates a cartesian product subject to any logical combination of wildcard exclusions. For example, suppose I want to generate a cartesian product S^n, n>=3, of that...
4
by: Chris | last post by:
Hi Everyone, I am using a regex to check for a string. When all the file contains is my test string the regex returns a match, but when I embed the test string in the middle of a text file a...
2
by: Lester | last post by:
I need a regexp function which makes a match when the string contains <img...AND the img tag above dows NOT contain a certain path Here is what I have: <img\s.*(src).+> This matches if my...
19
by: virtualadepts | last post by:
This contest is open to everyone who knows C++. To enter all you need to do is take the Boyer-Moore String Search Algorithm, as it is written in C, and make the fastest running C++ program you can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.