Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将正则表达式Python转换为正则表达式javascript_Javascript_Python_Regex - Fatal编程技术网

如何将正则表达式Python转换为正则表达式javascript

如何将正则表达式Python转换为正则表达式javascript,javascript,python,regex,Javascript,Python,Regex,我编写了一个正则表达式python,但我没有找到如何转换为与javascript兼容 我尝试使用表格比较,但它没有给我等价物或其他可能性 /^(\[([-\w]+)\])|(^;{0}([\w\.]+)[\s+=\s{0,}]+([\w\-\s\.\”\:\/]+)/gm 我尝试用[]、在“=”之前的键和在“=”之后的值捕获类别​​看起来是这样的,我对php.ini文件使用了()并排除了所有注释“;”: [exif] ; Exif UNICODE user comments are hand

我编写了一个正则表达式python,但我没有找到如何转换为与javascript兼容

我尝试使用表格比较,但它没有给我等价物或其他可能性

/^(\[([-\w]+)\])|(^;{0}([\w\.]+)[\s+=\s{0,}]+([\w\-\s\.\”\:\/]+)/gm
我尝试用[]、在“=”之前的键和在“=”之后的值捕获类别​​看起来是这样的,我对php.ini文件使用了()并排除了所有注释“;”:


[exif]
; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS.
; Local Variables:
;zend_extension="/Applications/MAMP/bin/php/php5.4.20/lib/php/extensions/no-debug-non-zts-20100525/eaccelerator.so"
  eaccelerator.shm_size="16"
  eaccelerator.cache_dir="/Applications/MAMP/tmp/eaccelerator"
  eaccelerator.enable="1"
[xcache-common]

xcache.admin.user = "xcache" ; comment
xcache.readonly_protection = Off
xcache.count =                 1
; just a hash hints, you can always store count(items) > slots
xcache.slots =                8K
;ttl of the cache item, 0=forever
xcache.ttl   = 

[Session]
session.save_path = /Applications/MAMP/tmp/php
;         use subdirectories for session storage
;
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="


在我的例子中,当前正则表达式不会捕获两个值键。

它应该已经在JavaScript中工作。您也可以删除
;{0}
,因为它是多余的。尝试使用:它支持两种语言,它会告诉您有什么问题不确定
[\s+=\s{0,}]
就是您在这里要做的事情…您也不需要逃避一切
[\w\-\s\.\“\:\/]
您甚至可以提供一些字符串,以便我们可以帮助您处理该模式。就目前而言,它看起来过于复杂了。试试
/^(\[([-\w]+)\])^([\w.]+)(?:\s*=[^\s\r\n]*(“[^”]*“\\\\s+))/g
,看看它应该已经可以在JavaScript中工作了。你还可以删除
;{0}
,因为它是多余的。试试使用:它支持两种语言,它会告诉你什么错误不确定
[\s=\s+\s}]
就是您在这里要做的事情…您也不需要逃避一切
[\w\-\s\.\“\:\/]
您甚至可以提供一些字符串,以便我们可以帮助您处理该模式。目前,它看起来过于复杂。请尝试
/^(\[([-\w]+)\]))|([\w.]+)(?:\s*=[^\s\r\n]*(“[^”]*“|\s+))/g
,请参阅