English 中文(简体)
定期表达法语特性
原标题:regular expression for French characters
  • 时间:2009-12-17 14:19:28
  •  标签:
  • php
  • regex

我需要一种功能或定期表达,以验证含有甲型(包括法语)特性的扼杀物,减去(-)、狗(......)和空间(不包括其他一切)。

增 编

最佳回答
/^[a-zàâçéèêëîïôûùüÿñæœ .-]*$/i

利用<代码>i进行个案审查,使事情更加简单。 如果你不希望允许空洞,则改动<代码>*至+

问题回答

简化解决办法:

/^[a-zA-ZÀ->。 页: 1

解释:

^ Start of the string [ ... ]* Zero or more of the following: a-z lowercase alphabets A-Z Uppercase alphabets À-ÿ Accepts lowercase and uppercase characters including letters with an umlaut - dashes . periods spaces $ End of the string

Try:

/^[p{L}-. ]*$/u

也就是说:

^         Start of the string
[ ... ]*  Zero or more of the following:
  p{L}     Unicode letter characters
  -         dashes
  .         periods
            spaces
$         End of the string
/u        Enable Unicode mode in PHP

此处使用的I类是:

<代码>[wÀ-Üà-øoù-ÿŒœ]。 这涉及的特性略高于法语,但排除了东欧和斯堪的纳维亚语中与法语无关的很大一部分。 我认为,这是短暂性和排他性之间的一种体面的妥协。

To match/validate complete sentences, I use this expression: [ws.,!?:;&#%’ "()«»À-Üà-øoù-ÿŒœ], which includes punctuation and French style quotation marks.

www.un.org/Depts/DGACM/index_spanish.htm 简单使用以下代码:

     /[u00C0-u017F]/

This line of regex pass throug all of cirano de bergerac french text: (you will need to remove markup language characters http://www.gutenberg.org/files/1256/1256-8.txt

^([0-9A-Za-zu00C0-u017F ,.; -()s:!?"])+

All French and Spanish accents /^[a-zA-ZàâäæáãåāèéêëęėēîïīįíìôōøõóòöœùûüūúÿçćčńñÀÂÄÆÁÃÅĀÈÉÊËĘĖĒÎÏĪĮÍÌÔŌØÕÓÒÖŒÙÛÜŪÚŸÇĆČŃÑ .-]*$/

这可能是恰当的:

/^[ a-zA-ZxBF-xFF.-]+$/

它像÷一样,给几个额外char子,但它处理的正是少数突出特征。





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

热门标签