Link to home
Start Free TrialLog in
Avatar of ross13
ross13Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Regular expression in vb.net

Hi,

I hope that someone is able to help. I am looking at writing a reg expression to try and find the first numeric value in a string (values from 0-9).

This string is going to be a postcode field so i need to find the first numeric value for the trim. This will either be a one or two value string field.

Regards,

Ross
SOLUTION
Avatar of nepaluz
nepaluz
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Don't really know what kind of regular expression you wish to build but you can get the position by something like this otherwise:

   Private Function CheckPosition(ByVal Mystring As String) As Short
        Dim z, y, x As Integer
        y = TextBox1.Text.Length
        For x = 0 To y - 1
            If IsNumeric(TextBox1.Text.Substring(x, 1)) Then
                y = x + 1
                Exit For
            End If
        Next
        Return y
    End Function
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial