English 中文(简体)
• 如何将reg与 j的 go角搜索矫正相匹配
原标题:How do you match a regex to a google search correction string in javascript

我需要利用reg获得“你指的是吗? 来源代码中的一部分来自 go探。 我不知道C#和javascript的reg之间有任何区别,但我不知道 the之间有何差别。

这是我在C#中的reg:

output = output.Replace(""", "");
string regex = "Did you mean: </span><a href=/search.[a-zA-Z0-9=&;_-]{1,}q=[a-zA-Z0-9+-]{1,}";

这是我手法中的内容:

var response = this.responseText.replace(""", "")
var regex = new RegExp("Did you mean: </span><a href=.search.[a-zA-Z0-9=&;_-]{1,}q=[a-zA-Z0-9+-]{1,}")

这是我从直角回来的答复的一部分:

style="color:#cc0000">Did you mean: </span><a href=/search?hl=en&amp;safe=off&amp;&amp;sa=X&amp;ei=DXtLTd2hKYjKgQfJ0sBD&amp;ved=0CBIQBSgA&amp;q=Linkin+Park-In+The+End&amp;spell=1"class=spell>Linkin Park-In <b><i>The</i></b> End</a>&nbsp;&nbsp;<br></div><!--a--><h2 class=hd>Search Results</h2><div id=ires><ol><li class="g videobox" id=videobox><h3 class=r><a href="/search?q=Linkin+Park-In+Th+End&amp;hl=en&amp;

我怎么能够正确对待javascript regex?

NOTE:我已经知道,C# regex只上过一页。

最佳回答

Why use regex here?

如果你注意到来源代码,则Did You Mean部分位于有topstuff/code>的鸿沟之内。 因此,您可以查阅这一鸿沟的<代码>innerHtml

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签