English 中文(简体)
A. 定期表述,以匹配 php的固定定义
原标题:Regular expression for matching php s constant definition
  • 时间:2012-01-12 15:31:18
  •  标签:
  • c#
  • php
  • regex

我写了一种固定的表达方式,以对“加拿大”的固定定义加以比较。

例:

define( Symfony∞DI , SYS_DIRECTORY_PUBLIC . SYS_DIRECTORY_INCLUDES . SYS_DIRECTORY_CLASSES . SYS_DIRECTORY_EXTERNAL .  symfony/di/ );

这里经常表达:

define(("| )+([w-.-∞]+)+("| )+(,)+((s)+("| )+([w-( )-\"-.-∞-s-(\)-/]+)+("| )|(([w-s-.-∞-(\)-/]+))));

当我以行动被处决时,他会做罚款。 但是,当我用C#执行时,它给我留下以下错误:

parsing "define(("| )+([w-.-∞]+)+("| )+(,)+((s)+("| )+([w-( )-\"-.-∞-s-(\)-/]+)+("| )|(([w-s-.-∞-(\)-/]+))));" - Cannot include class s in character range.

你们能否帮助我解决这一问题?

问题回答

看来,你正在以一种完全周密的方式使用:

  1. 品级: www.un.org/Depts/DGACM/index_french.htm 净吨处理量,而PHP处理量(或PHP可能不同) 页: 1

  2. 无需围绕<代码>s:s+,而不是+;同样,,,而不是(>,

  3. /code>并非是特别的,如果你想对两种特性加以匹配,则使用一个特性类别,而不是一个集团+替代物:[],而不是(>>(> 越出><>>>>>;并且注意到“只是因为你是双倍地引述的”;

  4. 页: 1

The 1. is probably the source of your problems.

以上所述内容的重述(两点引用):

"^define(([" ][w.∞]+[" ],(s+[" ]+[w ".∞s\/]+)+[" ]|([ws.∞\/]+)));"

which definitely doesn t look that it will ever match your input...

Try this instead:

"^define(s*([ "])[w.∞]+1s*,s*([w/]+(s*.s*[w/]+)*s*);$"

参看对你所重复的错误的答复。 这里不了解你做些什么,也不比你原来做的太多。

define(s*([]])s*[w.∞]+s*1(?:s*[,]s*([......]?]s*[w/]+s*2*s*);

define
(
  s* ([" ])
  s* [w.∞]+
  s* 1
  (?:
    s* [.,]
    s* ([" ]?)
    s* [w/]+
    s* 2
  )*
  s*
);




相关问题
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. ...