当前位置: 首页>>代码示例>>C#>>正文


C# JsString.match方法代码示例

本文整理汇总了C#中JsString.match方法的典型用法代码示例。如果您正苦于以下问题:C# JsString.match方法的具体用法?C# JsString.match怎么用?C# JsString.match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JsString的用法示例。


在下文中一共展示了JsString.match方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScriptFileFromStack

 // based on https://github.com/JamesMGreene/currentExecutingScript
 private static string ScriptFileFromStack(JsString stack)
 {
     var matches = stack.match(@"(data:text\/javascript(?:;[^,]+)?,.+?|(?:|blob:)(?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?");
     if (!matches.As<bool>())
     {
         matches = stack.match(@"^(?:|[^:@]*@|.+\)@(?=data:text\/javascript|blob|http[s]?|file)|.+?\s+(?: at |@)(?:[^:\(]+ )*[\(]?)(data:text\/javascript(?:;[^,]+)?,.+?|(?:|blob:)(?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?");
         if (!matches.As<bool>())
         {
             matches = stack.match(@"\)@(data:text\/javascript(?:;[^,]+)?,.+?|(?:|blob:)(?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?");
             if (!matches.As<bool>())
             {
                 return null;
             }
         }
     }
     return matches[1];
 }
开发者ID:CoderLine,项目名称:alphaTab,代码行数:18,代码来源:Environment.cs

示例2: parseAndPersistBehaviors

        void parseAndPersistBehaviors(JsString sheet)
        {
            JsString classSelector;
            JsRegExpResult randoriVendorItemsResult;
            JsRegExpResult randoriVendorItemInfoResult;
            JsRegExpResult CSSClassSelectorNameResult;
            /*
             * This regular expression then grabs all of the class selectors
             * \.[\w\W]*?\}
             *
             * This expression finds an -randori vendor prefix styles in the current cssSelector and returns 2 groups, the first
             * is the type, the second is the value
             *
             * \s?-randori-([\w\W]+?)\s?:\s?["']?([\w\W]+?)["']?;
             *
             */

            var allClassSelectors = new JsRegExp(@"^[\w\W]*?\}", "gm");

            const string RANDORI_VENDOR_ITEM_EXPRESSION = @"\s?-randori-([\w\W]+?)\s?:\s?[""']?([\w\W]+?)[""']?;";
            //These two are the same save for the global flag. The global flag seems to disable all capturing groups immediately
            var anyVendorItems = new JsRegExp(RANDORI_VENDOR_ITEM_EXPRESSION, "g");

            //This is the same as the one in findRelevant classes save for the the global flag... which is really important
            //The global flag seems to disable all capturing groups immediately
            var eachVendorItem = new JsRegExp(RANDORI_VENDOR_ITEM_EXPRESSION);

            var classSelectorName = new JsRegExp(@"^(.+?)\s+?{","m");
            JsString CSSClassSelectorName;
            JsString randoriVendorItemStr;

            var selectors = sheet.match(allClassSelectors);

            if (selectors != null ) {
                for (int i = 0; i < selectors.length; i++) {
                    classSelector = selectors[i];

                    randoriVendorItemsResult = classSelector.match(anyVendorItems);
                    if (randoriVendorItemsResult != null) {

                        CSSClassSelectorNameResult = classSelector.match(classSelectorName);
                        CSSClassSelectorName = CSSClassSelectorNameResult[1];

                        for (int j = 0; j < randoriVendorItemsResult.length; j++) {
                            randoriVendorItemStr = randoriVendorItemsResult[j];
                            randoriVendorItemInfoResult = randoriVendorItemStr.match(eachVendorItem);
                            map.addCSSEntry(CSSClassSelectorName, randoriVendorItemInfoResult[1], randoriVendorItemInfoResult[2]);
                            if (HtmlContext.window.console != null) {
                                HtmlContext.console.log(CSSClassSelectorName + " specifies a " + randoriVendorItemInfoResult[1] + " implemented by class " + randoriVendorItemInfoResult[2]);
                            }
                        }
                    }
                }
            }
        }
开发者ID:griffith-computing,项目名称:Randori,代码行数:55,代码来源:StyleExtensionManager.cs

示例3: parseResult

        void parseResult( JsString responseText )
        {
            //get each line
            JsRegExp eachLine = new JsRegExp(@"[\w\W]+?[\n\r]+", "g");
            JsRegExpResult eachLineResult = responseText.match( eachLine );

            this.fileLoaded = true;

            if (eachLineResult != null) {
                for ( int i=0;i<eachLineResult.length;i++) {
                    parseLine( eachLineResult[ i ] );
                }
            }
        }
开发者ID:griffith-computing,项目名称:Randori,代码行数:14,代码来源:PropertyFileTranslator.cs

示例4: parseLine

        void parseLine(JsString line)
        {
            if ( line.length == 0 ) {
                //empty line, bail
                return;
            }

            JsRegExp isComment = new JsRegExp(@"^[#!]");
            JsRegExpResult isCommentResult = line.match(isComment);

            if ( isCommentResult != null ) {
                //its a comment, bail
                return;
            }

            JsRegExp tokenize = new JsRegExp(@"^(\w+)\s?=\s?([\w\W]+?)[\n\r]+");
            JsRegExpResult tokenizeResult = line.match(tokenize);
            JsString key;
            JsString strValue;
            dynamic value;

            if ( tokenizeResult != null && tokenizeResult.length == 3) {
                key = tokenizeResult[ 1 ];
                value = tokenizeResult[ 2 ];

                strValue = value;
                if (strValue.indexOf( "," ) != -1 ) {
                    //this is an array, tokenize it
                    value = strValue.split( ',' );
                }

                keyValuePairs[ key ] = value;
            }
        }
开发者ID:griffith-computing,项目名称:Randori,代码行数:34,代码来源:PropertyFileTranslator.cs

示例5: resolveParentClassFromDefinition

        private void resolveParentClassFromDefinition(JsString qualifiedClassName, JsString classDefinition)
        {
            //\$Inherit\(net.digitalprimates.service.LabelService,([\w\W]*?)\)
            JsString inheritString = @"\$Inherit\(";
            inheritString += qualifiedClassName;
            inheritString += @",\s*(.*?)\)";
            JsRegExpResult inheritResult = classDefinition.match(inheritString);

            //Do we inherit from anything?
            if (inheritResult != null) {
                //Resolve the parent class first
                resolveClassName(inheritResult[1]);
            }
        }
开发者ID:griffith-computing,项目名称:RandoriGuiceJS,代码行数:14,代码来源:ClassResolver.cs

示例6: RFC3339StringToLocalDate

        public static JsDate RFC3339StringToLocalDate(JsString dateString)
        {
            JsDate localDate = null;

            if (dateString == null || dateString.length != 10 ) {
                throw new JsError("Invalid Date String");
            }

            var dateMatch = new JsRegExp(@"(\d\d\d\d)-(\d\d)-(\d\d)");
            var match = dateString.match(dateMatch);

            if (match != null) {
                dynamic yearString = match[1];
                dynamic monthString = match[2];
                dynamic dayString = match[3];

                localDate = new JsDate(yearString, monthString-1, dayString);
            }

            return localDate;
        }
开发者ID:RandoriCSharp,项目名称:randori-framework,代码行数:21,代码来源:GlobalUtilities.cs


注:本文中的JsString.match方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。