English 中文(简体)
预克_replace regex 型号中的前方闪电问题
原标题:Problem detecting forward slash in preg_replace regex pattern

我正在穿透可能含有街道数目的地狱。 使用I米的模式是:

([A-Za-z0-9]*)/i

对于1,1a,123等数量,可处以罚款。

然而,这并不像第1/54B号这样的街道号码。

我试图对这样的模式增加前方的分歧:

([A-Za-z0-9/]*)/i

但是,这一数字并没有像第1/54B号这样的数字。

关于我应当使用什么的想法?

最佳回答

提 出

preg_replace( #([A-Za-z0-9/]*)#i , $repl, $subj);

采用替代限制办法,使之更为简单。

问题回答

我认识到,在这个例子中,我忽视了前方的争执正在转化为《URL》友好守则(%2F),因此

([A-Za-z0-9\%]*)/i

为这种情况而努力。 我感到 Y。

感谢马修·马修先生的有益指导。 争取将此事提交。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签