Skip to content

Instantly share code, notes, and snippets.

@Uko
Created November 14, 2012 10:07
Show Gist options
  • Save Uko/4071330 to your computer and use it in GitHub Desktop.
Save Uko/4071330 to your computer and use it in GitHub Desktop.
String for parsing ASCII STL 3D format with regex. Normal can be retrieved by groups 1, 4 and 7, vertices by (10, 13, 16), (19, 22, 25), (28, 31, 34)
"facet\\s+?normal" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?outer\\s+?loop" +
"\\s+?vertex" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?vertex" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?vertex" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?(-?\\d+(\\.\\d+([eE][+-]\\d+)?)?)" +
"\\s+?endloop\\s+?endfacet"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment