如何将regex Python转换为regex javascrip

2024-05-16 05:14:28 发布

您现在位置:Python中文网/ 问答频道 /正文

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

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

/^(\[([-\w]+)\])|(^;{0}([\w\.]+)[\s+=\s{0,}]+([\w\-\s\.\"\:\/]+))/gm

我尝试用[]、键在“=”之前、值在“=”之后捕获类别,看起来是这样的,我使用了exec()作为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="

在我的例子中,当前的regex不能捕获两个值键中的一对。你知道吗


Tags: cachesessionascounttmpphpxcachettl