I wrote some code using Regular Expressions:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string input = @"ch/js/789747b7/scriptSearch.js"",videoJsSrc:""res/batch/js/3c9a6ee1/scriptVideo.js"",apiFormAppJSSrc:""res/batch/js/9fa7e22b/apiFormApp.js"",easyXDMJs:""res/batch/js/8f3e66db/easyXDM.min.js"",nativeHooksSrc:""res/batch/js/539ea638/nativeHooks.js"",gwtHash:""1bcb94eb"",jsessionId:";
Match output = Regex.Match(input, @"gwtHash:""(.*?)""").Value;
Console.WriteLine(output);
Console.ReadKey();
}
}
}
But I get this error:
Error 1 Cannot implicitly convert type 'string' to 'System.Text.RegularExpressions.Match' C:\Users\asus\AppData\Local\Temporary Projects\ConsoleApplication1\Program.cs 14 28 ConsoleApplication1
What’s wrong?
Property
Valuehas type ofstring. So, you need either assign result ofRegex.Matchmethod to yourMatchobject, and then write it’sValueto consoleOr change
outputvariable type to string:To get
1bcb94ebuse