

The is added to the line to always have at least one match: faster and easier code. TbStatusText.AppendText("Oops!" + vbCrLf) Tag = Mid(sInput, iNext + 1, iStart - iNext) SInput = "(" + Strings.Mid(sInput, 2) + ")"ĭim mMatch As Match = Regex.Match(sInput, sControlsPattern, RegexOptions.IgnoreCase Or RegexOptions.Compiled)
#Regex for number with decimal in as3 code#
Here is the code snippet for getting whole words of code (also in Visual Basic):Ĭode: Select all Dim sWork As String = "" Net object code as C#.) I also did not mention that no need to change the regex expression to handle uppercase letters, just tell regex to ignore case. (No matter with Visual Basic: it compiles - theoretically - to the same. I'm not a big fan of C#, I use it when I have to, but will never be in love with any kind of C. The problem was not with you and not with the code but me: I forgot to say that it's in Visual Basic. MessageBox.Show("Array Rows " + Convert.ToString(length)) Using (System.IO.StreamReader reader = new System.IO.StreamReader(fileStream) ) Using( System.IO.Stream fileStream = System.IO.File.Open(strCurrGcodeFilename, System.IO.FileMode.Open) ) Int myLineNumber = Convert.ToInt32(strGcode) MessageBox.Show(strGcode + "\n" + strCurrGcodeFilename) String strCurrGcodeFilename = exec.Getgcodefilename() // Get path + filename of current loaded gcode file String strGcode = AS3.Getfield(866) // read the current gcode line number The pattern switches are a bit to get your head around as there are a load of options available: Like Keith, Regex was bugging me and I needed to understand it a little more. Note, you need to load a g-code file first or it will throw up an exception (not worried about that at present, as I can deal with that later). it works but does not quite extract the data into the array rows in the way it's needed to (the pattern needs sorting / understanding a little more) But the bare bones is there for a bit more development.

I've come up with the following (note it's a work in progress piece of code.

Stepping back to that "Regex" method of extacting the g-code information from a line of code.
