const regex = /\/\*(.+?)\*\//;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('\\\/\\*(.+?)\\*\\\/', '')
const 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
}`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
if ((m = regex.exec(str)) !== null) {
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
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 JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions