By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

regex parsing fixed field text file

P: n/a
I have a text file that has fixed fields. I know how to grab the first
few values out of the string by declaring the pattern...

Dim pattern As String = _
"^(?<first>.{6})(?<last>.{8})(?<city>.+)$"

Dim re As New Regex(pattern)

I know that the "^(?<first>.{6})(?<last>.{8})(?<city>.+)$"
selects the first 6 characters then the next 8 characters then any
charaters that are left.

I want to grab a value that starts on the 10th character and ends on
the 23rd character.

What would the syntax be to get a value in the middle of the string?

something like this????
"^(?<first> STARTCHARACTER = 10 ENDCHARACTER =
23)(?<last>.{8})(?<city>.+)$"

Thaks!!

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.