不会写正则表达式,大神些帮帮忙!

Null_Reference Null_Reference 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
现在有个需求、需要得到配置文件里面的配置信息。想要通过正则表达式来获取

我想要获取每个server 里面的 字段信息 比如 listen、server_name 最终就是想把这个配置文件转成一个List<Server> 这样的

文本内容:


http {
include mime.types;

server {
listen 90;
server_name www.n.com;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
server {
listen 91;
server_name www.c.com;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}


}

}
...全文

相关推荐

还不会正则表达式?赶快看这篇!.docx

还不会正则表达式?赶快看这篇!.docx

惚如远行客

还不会正则表达式?赶快看这篇!

大家都很多时候都会觉得正则表达式难记、难学、难用,但不可否认的是正则表达式是一项很重要的技能,所有我将学习和使用正则表达式时的关键点整理如下,供大家参考

weixin_38519082

【全网最全】python正则表达式大全,所有讲解都在这,包教包会,学不会找我! (1).md

未经允许不得随意穿越,仅个人使用。博客有教程,本文件为本地文件。

川川菜鸟

正则表达式不包含align该怎么写

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] 您可能感兴趣的文章:正则表达式匹配不包含某些字符串的技巧PHP正则提取不包含指定网址的图片地址的例子用正则删除不包含某个字符串的行的代码用正则表达式表示不包含2950的字符串php 正则 不包含某字符串的正则表达式正则表达式不包含属性使用正则表达式找出不包含特定字符串的条目

weixin_38501610

还不会 JavaScript 中的正则表达式 ? 一篇文章带你轻松入门 !

还不会 JavaScript 中的正则表达式 ? 一篇文章带你轻松入门 ! 文章目录还不会 JavaScript 中的正则表达式 ? 一篇文章带你轻松入门 !一、前言 :二、阅前须知 :三、步入正题1. 什么是正则 ?2. 怎么使用正则 ?-1). 正则表达式的创建方式①. 字面量式②. 构造函数式-2). 字符匹配①. 两种模糊匹配②. 字符组(簇)③. 量词④. 多选分支-3). 位置匹配①. 什么是位置 ?②. 匹配位置③. 位置特性-4). 分组和分支结构①. 分组和分支结构②. 分组引用③. 反向引用④. 匹配不捕获(?: )-5). 回溯法原理①. 没有回溯的匹配②. 有回溯的匹配

weixin_38632146
评论 4
收藏 已收藏
分享
返回顶部
Null_Reference
C# 111,129 成员 642,538 内容