[Info-vax] DCL and scripting

Arne Vajhøj arne at vajhoej.dk
Wed Dec 12 21:06:33 EST 2018


On 12/12/2018 8:58 PM, Arne Vajhøj wrote:
> On 12/12/2018 8:34 PM, Dave Froble wrote:
>> On 12/12/2018 7:49 PM, Arne Vajhøj wrote:
>>> Regex is a bit cryptic. But it can be useful.
>>>
>>> But I will say that all programmers should know SQL, regex and XPath.
>>
>> I know some SQL.  I don't even know what regex and xpath is.
> 
> regex is a way to find patterns in text.
> 
> XPath is a way to select parts of an XML document.
> 
>>                                                              I guess 
>> according to you I should stick to flying.  Oh well, much more fun 
>> anyway.
>>
>> Now if it would just warm up ....
> 
> Or maybe something to study during Christmas vacation.
> 
> :-)

Simple regex example in VB.NET:

Imports System
Imports System.Text.RegularExpressions

Namespace DF1
     Public Class Program
         Public Shared Sub Main(args As String())
             Dim s As String = "bla bla bla 11-DEC-2018 bla bla bla 
12-DEC-2018 bla bla bla 13-DEC-2018 bla bla bla"
             For Each m As Match In Regex.Matches(s, 
"[0-9]{2}-[A-Z]{3}-[0-9]{4}")
                 Console.WriteLine(m.Value)
             Next
         End Sub
     End Class
End Namespace

Output:

11-DEC-2018
12-DEC-2018
13-DEC-2018

Arne




More information about the Info-vax mailing list