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

Regular Expressions Help

I am trying to break down the results of Request.ServerVariables("URL") into
just the name of the script. Currently, the output is looking like:

/lang/de/test.aspx

I want to strip the /lang/de/ and keep test.aspx. The /lang/de/ may not
always be there. Sometimes it may just be "/" or there may be more than 2
layers. I'm assuming that there should be an easy way to do this with
regular expressions, but I'm not very good at them. Any assistance would be
greatly appreciated.

--

Thank You,
Jason Williard
Nov 18 '05 #1
4 882
try this:

Dim str As String = "/lang/en/test.aspx"
Dim str1 As String = ""

Dim x As Integer = 0
For x = Len(str) - 1 To 0
If str.Chars(x) = "/" Then
str1 = Microsoft.VisualBasic.Right(str, x + 1)
Exit For
End If
Next

response.write(str1)
"Jason Williard" wrote:
I am trying to break down the results of Request.ServerVariables("URL") into
just the name of the script. Currently, the output is looking like:

/lang/de/test.aspx

I want to strip the /lang/de/ and keep test.aspx. The /lang/de/ may not
always be there. Sometimes it may just be "/" or there may be more than 2
layers. I'm assuming that there should be an easy way to do this with
regular expressions, but I'm not very good at them. Any assistance would be
greatly appreciated.

--

Thank You,
Jason Williard

Nov 18 '05 #2
That resulted in a blank page :-(

Any other ideas?

--

Thank You,
Jason Williard
Client Services
PCSafe, Inc.
"Allan" <Al***@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...
try this:

Dim str As String = "/lang/en/test.aspx"
Dim str1 As String = ""

Dim x As Integer = 0
For x = Len(str) - 1 To 0
If str.Chars(x) = "/" Then
str1 = Microsoft.VisualBasic.Right(str, x + 1)
Exit For
End If
Next

response.write(str1)
"Jason Williard" wrote:
I am trying to break down the results of Request.ServerVariables("URL")
into
just the name of the script. Currently, the output is looking like:

/lang/de/test.aspx

I want to strip the /lang/de/ and keep test.aspx. The /lang/de/ may not
always be there. Sometimes it may just be "/" or there may be more than 2
layers. I'm assuming that there should be an easy way to do this with
regular expressions, but I'm not very good at them. Any assistance would
be
greatly appreciated.

--

Thank You,
Jason Williard

Nov 18 '05 #3
Not its intended purpose, but if it works...

Dim s As String = System.IO.Path.GetFileName("/lang/de/test.aspx")

s = "test.aspx"

Greg
"Jason Williard" <ja********@gmail.com> wrote in message
news:ZZhbd.175671$wV.43073@attbi_s54...
I am trying to break down the results of Request.ServerVariables("URL")
into just the name of the script. Currently, the output is looking like:

/lang/de/test.aspx

I want to strip the /lang/de/ and keep test.aspx. The /lang/de/ may not
always be there. Sometimes it may just be "/" or there may be more than 2
layers. I'm assuming that there should be an easy way to do this with
regular expressions, but I'm not very good at them. Any assistance would
be greatly appreciated.

--

Thank You,
Jason Williard

Nov 18 '05 #4
Perfect! Thank you very much.

--

Thank You,
Jason Williard
"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:ee*************@TK2MSFTNGP09.phx.gbl...
Not its intended purpose, but if it works...

Dim s As String = System.IO.Path.GetFileName("/lang/de/test.aspx")

s = "test.aspx"

Greg
"Jason Williard" <ja********@gmail.com> wrote in message
news:ZZhbd.175671$wV.43073@attbi_s54...
I am trying to break down the results of Request.ServerVariables("URL")
into just the name of the script. Currently, the output is looking like:

/lang/de/test.aspx

I want to strip the /lang/de/ and keep test.aspx. The /lang/de/ may not
always be there. Sometimes it may just be "/" or there may be more than 2
layers. I'm assuming that there should be an easy way to do this with
regular expressions, but I'm not very good at them. Any assistance would
be greatly appreciated.

--

Thank You,
Jason Williard


Nov 18 '05 #5

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

Similar topics

11
by: Martin Robins | last post by:
I am trying to parse a string that is similar in form to an OLEDB connection string using regular expressions; in principle it is working, but certain character combinations in the string being...
4
by: GenoJoe | last post by:
If you are not new to VB.NET but are new to regular expressions, you need to get a free copy of "Pragmatic Guide to Regular Expressions for VB.NET Programmers". I wrote this guide because all of the...
2
by: cleo | last post by:
I'm experimenting with Regular Expressions and Windows Forms. Frequently I want a value to be either a valid pattern or empty. For example a Zip code must be 5 digits or may be empty. I know that...
7
by: norton | last post by:
Hello, Does any one know how to extact the following text into 4 different groups(namely Date, Artist, Album and Quality)? - Artist - Album Artist - Album - Artist - Album - Artist -...
4
by: lucky | last post by:
hi there!! i'm looking for a code snipett wich help me to search some words into a particular string and replace with a perticular word. i got a huge data string in which searching traditional...
4
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or...
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
3
by: a | last post by:
I'm a newbie needing to use some Regular Expressions in PHP. Can I safely use the results of my tests using 'The Regex Coach' (http://www.weitz.de/regex-coach/index.html) Are the Regular...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
3
by: Zeba | last post by:
Hi guys, I need some help regarding regular expressions. Consider the following statement : System.Text.RegularExpressions.Match match =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.