package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`\/\*(.+?)\*\/`)
var str = `using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using System.Text.RegularExpressions;
using System;
public interface IThemeable
{
}
public class TestScript : MonoBehaviour
{
#region Studio Style
class Program : IThemeable
{
static int _I = 1;
delegate void DoSomething();
static DoSomething DelegateMethod = delegate { };
/* This
is a multi line
quote
*/
/*single line quote*/
/* single line quote */
/// <summary>
/// The quick brown fox jumps over the lazy dog
/// THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
/// </summary>
static void Main(string[] args)
{
string normalStr = "The time now is approximately " + DateTime.Now;
Uri Illegal1Uri = new Uri("http://packmyboxwith/jugs.html?q=five-dozen&t=liquor");
Regex OperatorRegex = new Regex(@"\S#$", RegexOptions.IgnorePatternWhitespace);
for (int O = 0; O < 123456789; O++)
{
_I += (O % 3) * ((O / 1) ^ 2) - 5;
if (!OperatorRegex.IsMatch(Illegal1Uri.ToString()))
{
// no idea what this does!?
Console.WriteLine(Illegal1Uri + normalStr);
}
}
Program.DelegateMethod();
}
static int Sum(int a, int b)
{
return a + b;
}
}
#endregion
}`
if len(re.FindStringIndex(str)) > 0 {
fmt.Println(re.FindString(str),"found at index",re.FindStringIndex(str)[0])
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/