LimeSurvey Manual
Menu
Navigation
Main page
Recent changes
Random page
Help
Search
Special pages
Printable version
Recent changes
Help
English
Log in
Actions
Translate
Language statistics
Message group statistics
Export
Special
Export translations
Settings
Group
Activating a survey
Adding answers or subquestions
Administering LimeSurvey
Alternatives to the LimeSurvey import function
Assessments
Backup entire database
Batch deletion
Category:Advanced Question Settings
Category:General Question Options
Category:Question Settings
Central Participant Database
Changing an active survey
Check data integrity
Check question logic
Check survey logic - Advanced
Closing a survey
ComfortUpdate
Copy question
Data encryption
Data entry
Data policy settings
DateFunctions
Default answers
Delete question
Delete survey
Display/Export survey
Edit question
Email bounce tracking system
Email templates
Export question
Export responses
Exporting results
Expression Manager
Expression Manager sample surveys
ExpressionScript - Presentation
ExpressionScript Engine - Quick start guide
ExpressionScript examples
ExpressionScript How-tos
ExpressionScript sample surveys
Extension compatibility
Failed email notifications
First login - your user preferences
General FAQ
General settings
Getting started
Global settings
Google API howto
Home page settings
How to design a good survey (guide)
Import responses
Importing a survey
Installation - LimeSurvey CE
Installation FAQ
Installation of the LimeSurvey XAMPP package
Installation security hints
Installation using a command line interface (CLI)
Installation Version 1.92 or older
Iterate survey
Label sets
LDAP settings
License
LimeSurvey Manual
LimeSurvey PRO vs LimeSurvey CE
LimeSurvey Users
LimeSurvey Video-Tutorial
LimeSurvey-compatible hosting companies
List question groups
List questions
Localization
Major version upgrade
Make your plugin compatible with LS4
Manage user groups
Manage users
Menu configuration
Menu entries configuration
Multilingual survey
New Template System in LS3.x
Not categorized and advanced features
Notifications & data
Optional settings
Overview
Panel integration
Participant settings
Plugin manager
Plugin menu
Plugins - advanced
Presentation
Preview function
Problems & solutions
Publication & access
QS:Allowed filetypes
QS:Alphasort
QS:Answer width
QS:Array filter
QS:Array filter exclude
QS:Array filter style
QS:Assessment value
QS:Autocheck exclusive option
QS:Category separator
QS:Chart type
QS:Choice column width
QS:Choice header
QS:Code filter
QS:Commented checkbox
QS:CSS Class
QS:Date max
QS:Date min
QS:Date time format
QS:Display chart
QS:Display columns
QS:Display map
QS:Display rows
QS:Display type
QS:Dropdown dates
QS:Dropdown dates year max
QS:Dropdown dates year min
QS:Dropdown prefix
QS:Dropdown prepostfix
QS:Dropdown separators
QS:Dropdown size
QS:Dualscale headerA
QS:Dualscale headerB
QS:Em validation q
QS:Em validation q tip
QS:Em validation sq
QS:Em validation sq tip
QS:Encryption
QS:Equals num value
QS:Equation
QS:Exclusive option
QS:Get order previous q
QS:Hidden
QS:Hide tip
QS:Input box size
QS:Input boxes
QS:Input max characters
QS:Label column width
QS:Location city
QS:Location country
QS:Location defaultcoordinates
QS:Location mapheight
QS:Location mapservice
QS:Location mapwidth
QS:Location mapzoom
QS:Location nodefaultfromip
QS:Location postal
QS:Location state
QS:Mandatory
QS:Max answers
QS:Max filesize
QS:Max num value
QS:Max num value n
QS:Max num value sgqa
QS:Max subquestions
QS:Maximum chars
QS:Maximum number of files
QS:Min answers
QS:Min num value
QS:Min num value n
QS:Minimum number of files
QS:Minute step interval
QS:Month display style
QS:Multiflexible checkbox
QS:Multiflexible max
QS:Multiflexible min
QS:Multiflexible step
QS:Num value int only
QS:Numbers only
QS:Other
QS:Other comment mandatory
QS:Other numbers only
QS:Other Position
QS:Other replace text
QS:Page break
QS:Prefix
QS:Preg validation
QS:Printable survey relevance help
QS:Public statistics
QS:Question theme
QS:Random group
QS:Random order
QS:Rank header
QS:Relevance
QS:Remove text or uncheck checkbox
QS:Repeat headers
QS:Reverse
QS:Samechoiceheight
QS:Samelistheight
QS:Scale export
QS:Show comment
QS:Show grand total
QS:Show title
QS:Show totals
QS:Showpopups
QS:Slider accuracy
QS:Slider default
QS:Slider handle shape
QS:Slider handle Unicode shape
QS:Slider initial value
QS:Slider layout
QS:Slider max
QS:Slider middlestart
QS:Slider min
QS:Slider orientation
QS:Slider rating
QS:Slider reset
QS:Slider reverse
QS:Slider separator
QS:Slider showminmax
QS:Subquestion width
QS:Suffix
QS:Text input width
QS:Theme editor - advanced options
QS:Time limit
QS:Time limit action
QS:Time limit countdown message
QS:Time limit disable next
QS:Time limit disable prev
QS:Time limit message
QS:Time limit message delay
QS:Time limit message style
QS:Time limit timer style
QS:Time limit warning
QS:Time limit warning display time
QS:Time limit warning message
QS:Time limit warning style
QS:Use dropdown
QS:Value range allows missing
Question groups - introduction
Question toolbar options
Question type - 5 point choice
Question type - Array
Question type - Array (10 point choice)
Question type - Array (5 point choice)
Question type - Array (Increase-Same-Decrease)
Question type - Array (Numbers)
Question type - Array (Texts)
Question type - Array (Yes-No-Uncertain)
Question type - Array by column
Question type - Array dual scale
Question type - Date
Question type - Equation
Question type - File upload
Question type - Gender
Question type - Huge free text
Question type - Language switch
Question type - List (Dropdown)
Question type - List (Radio)
Question type - List with comment
Question type - Long free text
Question type - Multiple choice
Question type - Multiple choice with comments
Question type - Multiple numerical input
Question type - Multiple short text
Question type - Numerical input
Question type - Ranking
Question type - Short free text
Question type - Text display
Question type - Yes-No
Question types
Questions - introduction
QueXML PDF Export
Quick start guide - LimeSurvey 2.50+
Quick start guide - LimeSurvey 3.0+
Quick-translation
Regenerate question codes
Reorder questions and question groups
Reset conditions
Resources
Responses & statistics
Responses (survey results)
Running a survey safely
Setting conditions
SGQA identifier
Statistics
Survey group permissions
Survey menu
Survey participants
Survey permissions
Survey quotas
Survey settings
Survey settings version 2
Survey structure
Survey toolbar options
Surveys - introduction
Surveys - management
Tab Separated Value survey structure
Template:Deprecated
Template:DeprecatedIn
Template:Example
Template:FeatureChange
Template:FeatureStarting
Template:Hint
Template:NewIn
Template:UpdatedIn
Testing a survey
Text elements
Theme editor
Theme options
Themes
Timing statistics
Tools
Transferring an installation
Translating LimeSurvey
Troubleshooting
TwoFactorAdminLogin
Upgrading from a previous version
URL fields
Using regular expressions
Version change log
Version guide
View saved but not submitted responses
Workarounds
Language
aa - Afar
ab - Abkhazian
abs - Ambonese Malay
ace - Achinese
acm - Iraqi Arabic
ady - Adyghe
ady-cyrl - Adyghe (Cyrillic script)
aeb - Tunisian Arabic
aeb-arab - Tunisian Arabic (Arabic script)
aeb-latn - Tunisian Arabic (Latin script)
af - Afrikaans
aln - Gheg Albanian
alt - Southern Altai
am - Amharic
ami - Amis
an - Aragonese
ang - Old English
ann - Obolo
anp - Angika
ar - Arabic
arc - Aramaic
arn - Mapuche
arq - Algerian Arabic
ary - Moroccan Arabic
arz - Egyptian Arabic
as - Assamese
ase - American Sign Language
ast - Asturian
atj - Atikamekw
av - Avaric
avk - Kotava
awa - Awadhi
ay - Aymara
az - Azerbaijani
azb - South Azerbaijani
ba - Bashkir
ban - Balinese
ban-bali - Balinese (Balinese script)
bar - Bavarian
bbc - Batak Toba
bbc-latn - Batak Toba (Latin script)
bcc - Southern Balochi
bci - Baoulé
bcl - Central Bikol
bdr - West Coast Bajau
be - Belarusian
be-tarask - Belarusian (Taraškievica orthography)
bew - Betawi
bg - Bulgarian
bgn - Western Balochi
bh - Bhojpuri
bho - Bhojpuri
bi - Bislama
bjn - Banjar
blk - Pa'O
bm - Bambara
bn - Bangla
bo - Tibetan
bpy - Bishnupriya
bqi - Bakhtiari
br - Breton
brh - Brahui
bs - Bosnian
btm - Batak Mandailing
bto - Iriga Bicolano
bug - Buginese
bxr - Russia Buriat
ca - Catalan
cbk-zam - Chavacano
cdo - Min Dong Chinese
ce - Chechen
ceb - Cebuano
ch - Chamorro
cho - Choctaw
chr - Cherokee
chy - Cheyenne
ckb - Central Kurdish
co - Corsican
cps - Capiznon
cpx - Pu-Xian Min
cpx-hans - Pu-Xian Min (Simplified Han script)
cpx-hant - Pu-Xian Min (Traditional Han script)
cpx-latn - Pu-Xian Min (Latin script)
cr - Cree
crh - Crimean Tatar
crh-cyrl - Crimean Tatar (Cyrillic script)
crh-latn - Crimean Tatar (Latin script)
crh-ro - Crimean Tatar (Romania)
cs - Czech
csb - Kashubian
cu - Church Slavic
cv - Chuvash
cy - Welsh
da - Danish
dag - Dagbani
de - German
de-at - Austrian German
de-ch - Swiss High German
de-formal - German (formal address)
dga - Dagaare
din - Dinka
diq - Zazaki
dsb - Lower Sorbian
dtp - Central Dusun
dty - Doteli
dv - Divehi
dz - Dzongkha
ee - Ewe
egl - Emilian
el - Greek
eml - Emiliano-Romagnolo
en - English
en-ca - Canadian English
en-gb - British English
eo - Esperanto
es - Spanish
es-419 - Latin American Spanish
es-formal - Spanish (formal address)
et - Estonian
eu - Basque
ext - Extremaduran
fa - Persian
fat - Fanti
ff - Fula
fi - Finnish
fit - Tornedalen Finnish
fj - Fijian
fo - Faroese
fon - Fon
fr - French
frc - Cajun French
frp - Arpitan
frr - Northern Frisian
fur - Friulian
fy - Western Frisian
ga - Irish
gaa - Ga
gag - Gagauz
gan - Gan Chinese
gan-hans - Gan (Simplified)
gan-hant - Gan (Traditional)
gcr - Guianan Creole
gd - Scottish Gaelic
gl - Galician
gld - Nanai
glk - Gilaki
gn - Guarani
gom - Goan Konkani
gom-deva - Goan Konkani (Devanagari script)
gom-latn - Goan Konkani (Latin script)
gor - Gorontalo
got - Gothic
gpe - Ghanaian Pidgin
grc - Ancient Greek
gsw - Alemannic
gu - Gujarati
guc - Wayuu
gur - Frafra
guw - Gun
gv - Manx
ha - Hausa
hak - Hakka Chinese
haw - Hawaiian
he - Hebrew
hi - Hindi
hif - Fiji Hindi
hif-latn - Fiji Hindi (Latin script)
hil - Hiligaynon
hno - Northern Hindko
ho - Hiri Motu
hr - Croatian
hrx - Hunsrik
hsb - Upper Sorbian
hsn - Xiang Chinese
ht - Haitian Creole
hu - Hungarian
hu-formal - Hungarian (formal address)
hy - Armenian
hyw - Western Armenian
hz - Herero
ia - Interlingua
id - Indonesian
ie - Interlingue
ig - Igbo
igl - Igala
ii - Sichuan Yi
ik - Inupiaq
ike-cans - Eastern Canadian (Aboriginal syllabics)
ike-latn - Eastern Canadian (Latin script)
ilo - Iloko
inh - Ingush
io - Ido
is - Icelandic
it - Italian
iu - Inuktitut
ja - Japanese
jam - Jamaican Creole English
jbo - Lojban
jut - Jutish
jv - Javanese
ka - Georgian
kaa - Kara-Kalpak
kab - Kabyle
kai - Karekare
kbd - Kabardian
kbd-cyrl - Kabardian (Cyrillic script)
kbp - Kabiye
kcg - Tyap
kea - Kabuverdianu
kg - Kongo
khw - Khowar
ki - Kikuyu
kiu - Kirmanjki
kj - Kuanyama
kjh - Khakas
kjp - Eastern Pwo
kk - Kazakh
kk-arab - Kazakh (Arabic script)
kk-cn - Kazakh (China)
kk-cyrl - Kazakh (Cyrillic script)
kk-kz - Kazakh (Kazakhstan)
kk-latn - Kazakh (Latin script)
kk-tr - Kazakh (Turkey)
kl - Kalaallisut
km - Khmer
kn - Kannada
ko - Korean
ko-kp - Korean (North Korea)
koi - Komi-Permyak
kr - Kanuri
krc - Karachay-Balkar
kri - Krio
krj - Kinaray-a
krl - Karelian
ks - Kashmiri
ks-arab - Kashmiri (Arabic script)
ks-deva - Kashmiri (Devanagari script)
ksh - Colognian
ksw - S'gaw Karen
ku - Kurdish
ku-arab - Kurdish (Arabic script)
ku-latn - Kurdish (Latin script)
kum - Kumyk
kus - Kʋsaal
kv - Komi
kw - Cornish
ky - Kyrgyz
la - Latin
lad - Ladino
lb - Luxembourgish
lbe - Lak
lez - Lezghian
lfn - Lingua Franca Nova
lg - Ganda
li - Limburgish
lij - Ligurian
liv - Livonian
lki - Laki
lld - Ladin
lmo - Lombard
ln - Lingala
lo - Lao
loz - Lozi
lrc - Northern Luri
lt - Lithuanian
ltg - Latgalian
lus - Mizo
luz - Southern Luri
lv - Latvian
lzh - Literary Chinese
lzz - Laz
mad - Madurese
mag - Magahi
mai - Maithili
map-bms - Basa Banyumasan
mdf - Moksha
mg - Malagasy
mh - Marshallese
mhr - Eastern Mari
mi - Māori
min - Minangkabau
mk - Macedonian
ml - Malayalam
mn - Mongolian
mnc - Manchu
mnc-latn - Manchu (Latin script)
mnc-mong - Manchu (Mongolian script)
mni - Manipuri
mnw - Mon
mo - Moldovan
mos - Mossi
mr - Marathi
mrh - Mara
mrj - Western Mari
ms - Malay
ms-arab - Malay (Jawi script)
mt - Maltese
mus - Muscogee
mwl - Mirandese
my - Burmese
myv - Erzya
mzn - Mazanderani
na - Nauru
nah - Nāhuatl
nan - Min Nan Chinese
nap - Neapolitan
nb - Norwegian Bokmål
nds - Low German
nds-nl - Low Saxon
ne - Nepali
new - Newari
ng - Ndonga
nia - Nias
niu - Niuean
nl - Dutch
nl-informal - Dutch (informal address)
nmz - Nawdm
nn - Norwegian Nynorsk
no - Norwegian
nod - Northern Thai
nog - Nogai
nov - Novial
nqo - N’Ko
nrm - Norman
nso - Northern Sotho
nv - Navajo
ny - Nyanja
nyn - Nyankole
nys - Nyungar
oc - Occitan
ojb - Northwestern Ojibwa
olo - Livvi-Karelian
om - Oromo
or - Odia
os - Ossetic
pa - Punjabi
pag - Pangasinan
pam - Pampanga
pap - Papiamento
pcd - Picard
pcm - Nigerian Pidgin
pdc - Pennsylvania German
pdt - Plautdietsch
pfl - Palatine German
pi - Pali
pih - Norfuk / Pitkern
pl - Polish
pms - Piedmontese
pnb - Western Punjabi
pnt - Pontic
prg - Prussian
ps - Pashto
pt - Portuguese
pt-br - Brazilian Portuguese
pwn - Paiwan
qu - Quechua
qug - Chimborazo Highland Quichua
rgn - Romagnol
rif - Riffian
rki - Arakanese
rm - Romansh
rmc - Carpathian Romani
rmy - Vlax Romani
rn - Rundi
ro - Romanian
roa-tara - Tarantino
rsk - Pannonian Rusyn
ru - Russian
rue - Rusyn
rup - Aromanian
ruq - Megleno-Romanian
ruq-cyrl - Megleno-Romanian (Cyrillic script)
ruq-latn - Megleno-Romanian (Latin script)
rw - Kinyarwanda
ryu - Okinawan
sa - Sanskrit
sah - Yakut
sat - Santali
sc - Sardinian
scn - Sicilian
sco - Scots
sd - Sindhi
sdc - Sassarese Sardinian
sdh - Southern Kurdish
se - Northern Sami
se-fi - Northern Sami (Finland)
se-no - Northern Sami (Norway)
se-se - Northern Sami (Sweden)
sei - Seri
ses - Koyraboro Senni
sg - Sango
sgs - Samogitian
sh - Serbo-Croatian
sh-cyrl - Serbo-Croatian (Cyrillic script)
sh-latn - Serbo-Croatian (Latin script)
shi - Tachelhit
shi-latn - Tachelhit (Latin script)
shi-tfng - Tachelhit (Tifinagh script)
shn - Shan
shy - Shawiya
shy-latn - Shawiya (Latin script)
si - Sinhala
simple - Simple English
sjd - Kildin Sami
sje - Pite Sami
sk - Slovak
skr - Saraiki
skr-arab - Saraiki (Arabic script)
sl - Slovenian
sli - Lower Silesian
sm - Samoan
sma - Southern Sami
smn - Inari Sami
sms - Skolt Sami
sn - Shona
so - Somali
sq - Albanian
sr - Serbian
sr-ec - Serbian (Cyrillic script)
sr-el - Serbian (Latin script)
srn - Sranan Tongo
sro - Campidanese Sardinian
ss - Swati
st - Southern Sotho
stq - Saterland Frisian
sty - Siberian Tatar
su - Sundanese
sv - Swedish
sw - Swahili
syl - Sylheti
szl - Silesian
szy - Sakizaya
ta - Tamil
tay - Tayal
tcy - Tulu
tdd - Tai Nuea
te - Telugu
tet - Tetum
tg - Tajik
tg-cyrl - Tajik (Cyrillic script)
tg-latn - Tajik (Latin script)
th - Thai
ti - Tigrinya
tk - Turkmen
tl - Tagalog
tly - Talysh
tly-cyrl - Talysh (Cyrillic script)
tn - Tswana
to - Tongan
tok - Toki Pona
tpi - Tok Pisin
tr - Turkish
tru - Turoyo
trv - Taroko
ts - Tsonga
tt - Tatar
tt-cyrl - Tatar (Cyrillic script)
tt-latn - Tatar (Latin script)
tum - Tumbuka
tw - Twi
ty - Tahitian
tyv - Tuvinian
tzm - Central Atlas Tamazight
udm - Udmurt
ug - Uyghur
ug-arab - Uyghur (Arabic script)
ug-latn - Uyghur (Latin script)
uk - Ukrainian
ur - Urdu
uz - Uzbek
uz-cyrl - Uzbek (Cyrillic script)
uz-latn - Uzbek (Latin script)
ve - Venda
vec - Venetian
vep - Veps
vi - Vietnamese
vls - West Flemish
vmf - Main-Franconian
vmw - Makhuwa
vo - Volapük
vot - Votic
vro - Võro
wa - Walloon
wal - Wolaytta
war - Waray
wls - Wallisian
wo - Wolof
wuu - Wu Chinese
wuu-hans - Wu Chinese (Simplified)
wuu-hant - Wu Chinese (Traditional)
xal - Kalmyk
xh - Xhosa
xmf - Mingrelian
xsy - Saisiyat
yi - Yiddish
yo - Yoruba
yrl - Nheengatu
yue - Cantonese
yue-hans - Cantonese (Simplified)
yue-hant - Cantonese (Traditional)
za - Zhuang
zea - Zeelandic
zgh - Standard Moroccan Tamazight
zh - Chinese
zh-cn - Chinese (China)
zh-hans - Simplified Chinese
zh-hant - Traditional Chinese
zh-hk - Chinese (Hong Kong)
zh-mo - Chinese (Macau)
zh-my - Chinese (Malaysia)
zh-sg - Chinese (Singapore)
zh-tw - Chinese (Taiwan)
zu - Zulu
Format
Export for off-line translation
Export in native format
Export in CSV format
Fetch
{{DISPLAYTITLE:使用正则表达式}}<languages /> __TOC__ 正则表达式必须以斜杠("/")作为开头和结尾。你可以在 http://www.regexlib.net/ 找到一个很好的参考示例。如果都有斜杠包围,那么这些模板都可以工作。 你可以通过 [https://regex101.com/ 正则表达式测试器]来测试你的正则表达式。 {{Note|为了完善百科的这一部分,我们诚挚的建议你将你测试过的成功的正则表达式加入进来,以便使新的 LimeSurvey (潜在的) 用户能够更好的理解这一功能。}} {{Alert|title=Attention|text= 请注意下面所有的例子都是在一行内完成!}} <span id="Important:_Regular_Expressions_in_conditions"></span> =重要:条件中的正则表达式= 请注意在条件编辑器中使用正则表达式,不要包含前后的斜杠。 <span id="Email_validation"></span> =邮件地址验证= <div class="mw-translate-fuzzy"> (2018/12 更新): 从这些日子开始,域名不仅可以包含特殊字符,像 “ü” ,还可以使用超过3个字符的名字作为域名,像 ''tech'' 或是 ''company'',下面的邮件地址正则表达式只检查输入的邮件地址里是否包含“@” 和 “.” 。 <source lang="html"> /^.+?@.+?\..+$/ </source> 这个过时的正则表达式中,域名被限制在3个字符以内,不能覆盖所有的可用域名: <source lang="html"> /^(\w[-._+\w]*\w@\w[-._\w]*\w\.\w{2,3})$/ </source> </div> If you want to validate one address per line, in a multiline long text field: <source lang="html"> /^(((\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*(\r\n)?\n?)+)*)$/ </source> At this outdated regex the domain name is limited to 3 characters which doesn't cover all available domains: <source lang="html"> /^(\w[-._+\w]*\w@\w[-._\w]*\w\.\w{2,3})$/ </source> <span id="Postcodes"></span> =邮政编码= <span id="Australian_postcodes:"></span> ==澳大利亚的邮政编码== <source lang="html">/^[0-9]{4}/</source> <span id="Brazilian_postcodes"></span> ==巴西的邮政编码== <source lang="html">/^[0-9]{2}\.[0-9]{3}-[0-9]{3}$/</source> <span id="Canadian_postcodes"></span> ==加拿大的邮政编码== <source lang="html">/^[a-zA-Z]\d{1}[a-zA-Z](\-| |)\d{1}[a-zA-Z]\d{1}$/</source> <span id="US_postal_codes"></span> ==美国邮政编码== <source lang="html">/^[0-9]{5}([- /]?[0-9]{4})?$/</source> 以零开头的邮政编码,使用: <source lang="html">/^[0-9]{5}(?:-[0-9]{4})?$/</source> <span id="UK_postcodes"></span> ==英国邮政编码== <source lang="html">/^[A-Z][A-Z]?[0-9][A-Z0-9]? ?[0-9][ABDEFGHJLNPQRSTUWXYZ]{2}$/i</source> 注意这个并不是非常准确,一个精确的验证会非常复杂。比如: [https://stackoverflow.com/questions/164979/uk-postcode-regex-comprehensive 堆栈溢出的答案] 和 [https://en.wikipedia.org/wiki/Talk:Postcodes_in_the_United_Kingdom#Regular_Expressions 维基百科] 有更多相关的信息。 <span id="French_postcodes"></span> ==法国邮政编码== <source lang="html">/(^[0-8]\d\d{3}$)|(^9[0-5]\d{3}$)|(^97[1-6]\d{2}$)|(^98[46-8]\d{2}$)/</source> 上面的表达式非常精确,可以用来验证法国的部门是否存在 (前两个数字), 包含海外的部门和海外属地(DOM-TOM). <span id="Phone_numbers"></span> =电话号码= <span id="US_phone_numbers"></span> ==美国电话号码== <source lang="html">/^(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2}(?:\-?|\ ?))[2-9]\d{2}[- ]?\d{4}$/</source> 或者 <source lang="html">/^[\(\)\.\- ]{0,}[0-9]{3}[\(\)\.\- ]{0,}[0-9]{3}[\(\)\.\- ]{0,}[0-9]{4}[\(\)\.\- ]{0,}$/</source> 第二个选项将匹配所有的包括非数字标识的加拿大和美国的电话号码,包括: <source lang="html"> . ( ) - (space)</source> 这个将允许你匹配类型下面的电话号码: *(555)555 5555 *555.555.5555 *555 555 5555 *(555)-555-5555 *555-555-5555 *555555555 <span id="Australian_phone_numbers"></span> ==澳大利亚电话号码== 下面的模式匹配了所有各种各样的澳大利亚的移动电话和座机的号码,还包括有 "+61" 国家号码前缀的: *(02) 9123 6535 *03 1234-5345 *0412 345 678 *+61 2 3456 789 但不包括: * 234 3450 234 *a234 534 3432 *134567 *123456789013 括号,空格和横线都会被忽略掉。 这里的'非常精确'的意思:此处罗列的版本和电话的前4个或前5个数字匹配,以确保这段号码在澳大利亚的有效的。 '不很精确:' 只和前面第一或第二位的数字匹配,因此会允许输入许多无效的数字。 <span id="All_Australian_phone_numbers_(mobile_and_landline_-_area_code_required)"></span> ===所有澳大利亚电话号码 (移动电话和座机 - 需要区号)=== 非常精确: <source lang="html">/^\(?(?:\+?61|0)(?:(?:2\)?[ -]?(?:3[ -]?[38]|[46-9][ -]?[0-9]|5[ -]?[0-35-9])|3\)?(?:4[ -]?[0-57-9]|[57-9][ -]?[0-9]|6[ -]?[1-67])|7\)?[ -]?(?:[2-4][ -]?[0-9]|5[ -]?[2-7]|7[ -]?6)|8\)?[ -]?(?:5[ -]?[1-4]|6[ -]?[0-8]|[7-9][ -]?[0-9]))(?:[ -]?[0-9]){6}|4\)?[ -]?(?:(?:[01][ -]?[0-9]|2[ -]?[0-57-9]|3[ -]?[1-9]|4[ -]?[7-9]|5[ -]?[018])[ -]?[0-9]|3[ -]?0[ -]?[0-5])(?:[ -]?[0-9]){5})$/ </source> 不很精确: <source lang="html">/^(?:\+?61|0)[2-478](?:[ -]?[0-9]){8}$/</source> <span id="All_Australian_phone_numbers_(landlines_only_-_area_code_required)"></span> ===所有澳大利亚电话号码 (移动电话和座机 - 需要区号)=== 非常精确: <source lang="html">/^\(?(?:\+?61|0)(?:2\)?[ -]?(?:3[ -]?[38]|[46-9][ -]?[0-9]|5[ -]?[0-35-9])|3\)?(?:4[ -]?[0-57-9]|[57-9][ -]?[0-9]|6[ -]?[1-67])|7\)?[ -]?(?:[2-4][ -]?[0-9]|5[ -]?[2-7]|7[ -]?6)|8\)?[ -]?(?:5[ -]?[1-4]|6[ -]?[0-8]|[7-9][ -]?[0-9]))(?:[ -]?[0-9]){6}$/</source> 不很精确: <source lang="html">/^(?:\+?61|\(?0)[2378]\)?(?:[ -]?[0-9]){8}$/</source> <span id="New_South_Wales_landline_phone_numbers_(area_code_optional)"></span> ===新南威尔士州的固定电话(区号可选)=== 非常精确: <source lang="html">/^(?:\(?(?:\+?61|0)2\)?[ -]?)?(?:3[ -]?[38]|[46-9][ -]?[0-9]|5[ -]?[0-35-9])(?:[ -]?[0-9]){6}$/</source> 不很精确: <source lang="html">/^(?:\(?(?:\+?61|0)2\)?(?:[ -]?[0-9]){7}[0-9]$/</source> <span id="Victorian_and_Tasmanian_landline_phone_numbers_(area_code_optional)"></span> ===维多利亚和塔斯马尼亚州的固定电话(区号可选)=== 非常精确: <source lang="html">/^(?:\(?(?:\+?61|0)3\)?[ -]?)?(?:4[ -]?[0-57-9]|[57-9][ -]?[0-9]|6[ -]?[1-67])(?:[ -]?[0-9]){6}$/</source> 不很精确: <source lang="html">/^(?:\(?(?:\+?61|0)3\)?(?:[ -]?[0-9]){7}[0-9]$/</source> <span id="Queensland_landline_phone_numbers_(area_code_optional)"></span> ===昆士兰固定电话号码(区号可选)=== 非常精确: <source lang="html">/^(?:\(?(?:\+?61|0)7\)?[ -]?)?(?:[2-4][ -]?[0-9]|5[ -]?[2-7]|7[ -]?6)(?:[ -]?[0-9]){6}$/</source> 不很精确: <source lang="html">/^(?:\(?(?:\+?61|0)7\)?(?:[ -]?[0-9]){7}[0-9]$/</source> <span id="South_Australia,_Northern_Territory,_Western_Australia_landline_phone_numbers_(area_code_optional)"></span> ===南澳大利亚,北领地,西澳大利亚的座机电话号码(区号可选)=== 非常精确: <source lang="html">/^(?:\(?(?:\+?61|0)8\)?[ -]?)?(?:5[1-4]|6[0-8]|[7-9][0-9])$/</source> 不很精确: <source lang="html">/^(?:\(?(?:\+?61|0)8\)?(?:[ -]?[0-9]){7}[0-9]$/</source> <span id="Australian_mobile_phone_numbers_only"></span> ===仅限澳大利亚手机号码=== 非常精确: <source lang="html">/^(?:\+?61|0)4 ?(?:(?:[01] ?[0-9]|2 ?[0-57-9]|3 ?[1-9]|4 ?[7-9]|5 ?[018]) ?[0-9]|3 ?0 ?[0-5])(?: ?[0-9]){5}$/</source> 不很精确: <source lang="html">/^(?:\(?(?:\+?61|0)4\)?(?:[ -]?[0-9]){7}[0-9]$/</source> ==比利时电话号码== <source lang="html">/^((\+|00)32\s?|0)(\d\s?\d{3}|\d{2}\s?\d{2})(\s?\d{2}){2}$/</source> ==比利时手机号码== <source lang="html">/^((\+|00)32\s?|0)4(60|[789]\d)(\s?\d{2}){3}$/</source> ==法国电话号码== <source lang="html">/^((\+|00)33\s?|0)[1-59](\s?\d{2}){4}$/</source> ==法国移动电话号码== <source lang="html">/^((\+|00)33\s?|0)[67](\s?\d{2}){4}$/</source> ==卢森堡电话号码== <source lang="html">/^((\+|00\s?)352)?(\s?\d{2}){3,4}$/</source> ==卢森堡移动电话号码== <source lang="html">/^((\+|00\s?)352)?\s?6[269]1(\s?\d{3}){2}$/</source> =德国标记(带有可选的正负号)= <source lang="html">/^[1-6]{1}[\+|\-]?$/</source> <span id="Age_validation"></span> =年龄验证= 示例:年龄 20-99 <source lang="html">/([2-9][0-9])/</source> 示例:年龄 18-35 <source lang="html">/(1[8-9]|2[0-9]|3[0-5])/</source> 示例:年龄 19-65 <source lang="html">/^(1[8-9]|[2-5][0-9]|6[0-5])$/</source> <span id="Number_validation"></span> =数字验证= ==从 1 到 99999 的数字== <source lang="html">/^([1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9])$/</source> <source lang="html">/^[1-9][0-9]{0,4}$/ does the same as above but should run a little faster</source> ==从 1 到 999, 从1.000 到 999.999 到 999.999.999 的数字== <source lang="html">/^[1-9][0-9]{0,2}(?:\.[0-9]{3}){0,2}$/</source> 匹配从 1 到 999, 1.000 到 999.999 到 999.999.999 的数字,不匹配像 999.1.1 , 94.22.22, 999.1.22, 999.11.1, 999.1.333 的数字。 ==带有可选小数的数字验证(价格)== 匹配从 0 到 199 的数字, 可选是否带两位小数: <source lang="html">/^([1][0-9][0-9]|[1-9][0-9]|[0-9])((\.)[0-9][0-9])?$/</source> ==用千位分隔符进行数字验证== 空格做分隔符,没有减号 <source lang="html">/^(?!0)\d{1,3}(\ \d{3})*$/</source> 点做分隔符,允许减号 <source lang="html">/^-?(?!0)\d{1,3}(\.\d{3})*$/</source> 强制两位小数,匹配从 1.00 到 999,999,999.00 的数字,并可用逗号分隔千万/百万,以下数字都是匹配的: 1.00, 1,000.00, 12,345.67, 12345,02, 123,456,468.00, 1234566.00, 123456789.00 but not 1,23.00, 12,3.4 or 1234,43.04 <source lang="html">/^[1-9][0-9]{0,2}(?:,?[0-9]{3}){0,3}\.[0-9]{2}$/</source> 和上面相似:强制两位小数,但可以在小数点分隔符 "," 前面加 "0" 。 <source lang="html">/[0-9]{0,2}(?:,?[0-9]{3}){0,3}\.[0-9]{2}$/</source> 和上面一样,但两位小数变成可选项: <source lang="html">/^[1-9][0-9]{0,2}(?:,?[0-9]{3}){0,3}(?:\.[0-9]{2})?$/ </source> <span id="Month_(1-12)"></span> ==月份 (1-12)== 如果你要验证某人输入的出生月份是否正确可以使用下面的表达式: <source lang="html">/^[0]*[1-9]$|^[0]*1[0-2]$/</source> <span id="Minimum_width_(set_to_3_in_this_example)"></span> =最小宽度 (本示例中设置为 3 )= <source lang="html">/^.{3,}$/</source> <span id="Currency"></span> =货币= <span id="US_currency_(dollar_sign_and_cents_optional)"></span> ==美元(美元符号和美分可选)== <source lang="html">/^\$?\d+(\.(\d{2}))?$/</source> 检查逗号用法: <source lang="html">/^\$?\d{1,3}(\d+(?!,))?(,\d{3})*(\.\d{2})?$/</source> <span id="Swiss_price"></span> ==瑞士价格== 一个带有两个十进制数字的数字,小数点后的最后一个数字为5或0: <source lang="html">/^(\d+)(\.\d(05)?)?$/</source> <span id="Validate_score"></span> =验证分数= ==1-10== <source lang="html">/^[1-9]{1}$|^10$/</source> ==1-100== <source lang="html">/^[1-9]?[0-9]{1}$|^100$/</source> <span id="Text_validation"></span> =验证文本= [[Question type - Multiple short text|多重短文本题型]] 当前不支持最小或最大的答案。可以使用带正则表达式的 [[Question type - Long free text| 文本输入(长)题型]] 来替代。 下面的表达式测试的内容是每行至少一个词,最少3行,最多10行。 <source lang="html">/(?:[^,.;:?!& \n\r]+(?: [^,.;:?!& \n\r]+)*)(?:[,.;:?!& \n\r]?(?:\n|\r|\n\r|\r\n)(?:[^,.;:?!& \n\r]+(?: [^,.;:?!& \n\r]+)*)){2,10}/is</source> 如果你要If you want, 在一行里放5个词,你可以把第一个和最后一个星号改成 {4,}: <source lang="html">/(?:[^,.;:?!& \n\r]+(?: [^,.;:?!& \n\r]+){4,})(?:[,.;:?!& \n\r]?(?:\n|\r|\n\r|\r\n)(?:[^,.;:?!& \n\r]+(?: [^,.;:?!& \n\r]+){4,})){2,10}/is</source> 如果你要一行里有一个或多个词 (在第一行和第五行之间), 你可以把最后的大括号里的内容改成 '''0,4''' (注意你使用 0 是因为你要从第一行开始匹配). <source lang="html">/(?:[^,.;:?!& \n\r]+(?: [^,.;:?!& \n\r]+)*)(?:[,.;:?!& \n\r]?(?:\n|\r|\n\r|\r\n)(?:[^,.;:?!& \n\r]+(?: [^,.;:?!& \n\r]+)*)){0,4}/is</source> <span id="Word_count"></span> ==单词计数== 以下内容将允许的字数限制为最少1个和最多200个: <source lang="html">/^[-\w]+(?:\W+[-\w]+){0,199}\W*$/</source> 要增加最小值,请更改{0,199}的零部分。 要增加或减少最大值,请更改{0,199}的“ 199”部分。 <span id="Time_validation"></span> =时间验证= 时间格式有大量的书写方式。一些可能的选项是12小时或24小时,有或没有秒。尽管可以使用 [[Question type - Date|日期题型]] (可以获取时间) ,你可以使用带下面任一个正则表达式的 [[Question type - Short free text|文本输入(短)题型 ]] 。 下面三个验证时间的字符串分别是24小时的时间(按出现顺序) 没有秒,有可选秒和最后必须有秒: <source lang="html">/^(?:[01][0-9]|2[0-3]):[0-5][0-9]$/</source> <source lang="html">/^(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9])?$/</source> <source lang="html">/^(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/</source> 下面三个匹配 12 小时时间,和上面一样,有秒,可选秒和必须有秒: <source lang="html">/^(?">00:[0-5][0-9] (?:am|AM)|(?:0[1-9]|1[01]):[0-5][0-9] (?:[ap]m|[AP]M)|12:[0-5][0-9] (?:pm|PM))$/</source> <source lang="html">/^(?:00:[0-5][0-9](?::[0-5][0-9])? (?:am|AM)|(?:0[1-9]|1[01]):[0-5][0-9](?::[0-5][0-9])? (?:[ap]m|[AP]M)|12:[0-5][0-9](?::[0-5][0-9])? (?:pm|PM))$/</source> <source lang="html">/^(?:00:[0-5][0-9]:[0-5][0-9] (?:am|AM)|(?:0[1-9]|1[01]):[0-5][0-9]:[0-5][0-9] (?:[ap]m|[AP]M)|12:[0-5][0-9]:[0-5][0-9] (?:pm|PM))$/</source> 下面三个匹配 12 或是 24 小时时间,有秒,可选秒和必须有秒: <source lang="html">/^(?:(?:00:[0-5][0-9] (?:am|AM)|(?:0[1-9]|1[01]):[0-5][0-9] (?:[ap]m|[AP]M)|12:[0-5][0-9] (?:pm|PM))|(?:[01][0-9]|2[0-3]):[0-5][0-9])$/</source> <source lang="html">/^(?:(?:00:[0-5][0-9](?[0-5][0-9])? (?:am|AM)|(?:0[1-9]|1[01]):[0-5][0-9](?[0-5][0-9])? (?:[ap]m|[AP]M)|12:[0-5][0-9](?[0-5][0-9])? (?:pm|PM))|(?:[01][0-9]|2[0-3]):[0-5][0-9](?[0-5][0-9])?)$/</source> <source lang="html">/^(?:(?:00:[0-5][0-9]:[0-5][0-9] (?:am|AM)|(?:0[1-9]|1[01]):[0-5][0-9]:[0-5][0-9] (?:[ap]m|[AP]M)|12:[0-5][0-9]:[0-5][0-9] (?:pm|PM))|(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$/</source> <span id="US_states"></span> =美国各州= 使用下面的表达式验证州 (示例是 Texas): *TX 仅大写: <source lang="html">/^(TX)$/</source> *tx 仅小写: <source lang="html">/^(tx)$/</source> *TX 大写或小写: <source lang="html">/^([T|t][X|x])$/</source> <span id="Profanity_Filter"></span> =敏感词过滤器= 从答案中过滤敏感词: <source lang="html">/^(?i)((?!\bENTERPROFANITYHERE\b).)*$(?-i)/</source> 用 "ENTERPROFANITYHERE" 替换你的敏感词。 如果你把 "ass" 或是 "hell" 定义为你的敏感词,那么 \b 将允许跳过类似 "assassination" 和 "hello" 的单词,如果你要忽略答案中其他的单词,名字什么的,也可以这么使用。 <span id="Helpful_links"></span> =有帮助的链接= <div class="mw-translate-fuzzy"> 在这个百科部分的开头部分,我们推荐你使用 https://regex101.com/ 测试和创建正则表达式。你也可以使用 https://www.regextester.com/ 来创建正则表达式,如果你不喜欢第一个选项的话。 </div>