Locate Pattern the Letter I followed by a space then three alpha numerics followed by a space

Need to locate the following pattern:

The letter I followed by a space then three alpha numerics followed by a space

"I ALN " "I H21 " "I 31M "

these items are also followed by a lat/lon that is trapped by this expression:

Dim regex As New Regex("\d{6} \d{7}")

Can the expressions be combined to return a match that would look like:

"H21 ###### #######"

Thanks,

Dave

Answers


/I ([0-z]{3} \d{6} \d{7})/

I don't know VB, but that regex would work with say perl.

Update: Given the new string provided.. something like this may work (depending on responses to my questions)

/^[A-z] ([0-z]{3}) [A-z] [0-z]{3} L (\d{6} \d{7})/

Matches would then be joined (match 1 containing the AAA, match 2 containing the Lat/Long).

Update #2: From OP: No on the pattern. The only pattern is I AAA then on the same line the 4000931 0892006. Can you add an OR statement to an expression

You can add an OR, sort of, but I'm uncertain that this is really what you want? This new regex will match I, followed by a space, followed by 3 alpha numeric characters, and then "anything", and the lat/long. Note tho that if there's data in the file or whatever you're parsing that matches a line like that (in that it's "other" data, but follows a similar pattern), you'll probably catch that too.

/^I ([0-z]{3}) .* (\d{6} \d{7})/


Need Your Help

Rails: Proper setup with DNS, Rack-rewrite etc for Heroku

ruby-on-rails dns rack-rewrite

I have looked all over the internet but could not get one final solution to what I would expect to be the 100% proper setup of DNS etc to get the following result on Heroku.com:

EventHandler is not working for dynamic control

c# asp.net .net

I have referred Error with the event handlers of dynamic linkbutton . It says to add event handlers in Page_Init or Page_Load. I tired following code. But the event handler is not fired when I clic...