using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^([ \t]*)import [*] as (\w+) from (?:(['])((?:(?:\.)+|[^\n\r'\\]+)+)[']|([""])((?:(?:\.)+|[^\n\r'\\]+)+)[""])";
string substitution = @"$1import $2 from $3$5$6$4$3$5";
string input = @"import * as Atblock from ""./atblock""
import * as Atrule from ""./atrule""
import * as Supports from ""./supports""
import * as Node from './node';
import * as Root from './root'
import Null from './null'
import * as Each from './each'
import * as If from './if'
import * as Call from './call'
import * as UnaryOp from './unaryop'
import * as BinOp from './binop'
import * as Ternary from './ternary'
import * as Block from './block'
import * as Unit from './unit'
import * as String from './string'
import * as HSLA from './hsla'
import * as RGBA from './rgba'
import * as Ident from './ident'
import * as Group from './group'
import * as Literal from './literal'
import * as Boolean from './boolean'
import * as Return from './return'
import * as Media from './media'
import * as QueryList from './query-list'
import * as Query from './query'
import * as Feature from './feature'
import * as Params from './params'
import * as Comment from './comment'
import * as Keyframes from './keyframes'
import * as Member from './member'
import * as Charset from './charset'
import * as Namespace from './namespace'
import * as Import from './import'
import * as Extend from './extend'
import * as Object from './object'
import * as Function from './function'
import * as Property from './property'
import * as Selector from './selector'
import * as Expression from './expression'
import * as Arguments from './arguments'
import * as Atblock from './atblock'
import * as Atrule from './atrule'
import * as Supports from './supports'
";
RegexOptions options = RegexOptions.Multiline;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx