正则表达式引擎库汇合

 1.总览表格

一些正则表达式库的对比
index库名编程语言说明代码示例编译指令
1Posix正则C语言是C标准库中用于编译POSIX风格的正则表达式库
 
posix-re.cgcc posix-re.c 
2PCRE库C语言提供类似Perl语言的一个正则表达式引擎库。

一般系统上对应/usr/lib64/libpcre.so这个库文件,它 是PCRE(Perl Compatible Regular Expressions)库的动态链接库文件,通常用于在Linux系统中提供对正则表达式的支持。PCRE库是由 Philip Hazel 开发的,提供了对Perl风格正则表达式的支持,包括编译、执行和处理正则表达式的功能。

test-pcre.cgcc test-pcre.c  -lpcre
3RE2C++RE2是google开源的正则表达式一厍,田Rob Pike和 Russ Cox 两位来自google的大牛用C++实现。它快速、安全,线程友好,是PCRE、PERL 和Python等回溯正则表达式引擎(backtracking regularexpression engine)的一个替代品。RE2支持Linux和绝大多数的Unix平台。

2.代码示例

2.1 posix-re.c

#include <stdio.h>
#include <regex.h>int main() {regex_t regex;int ret;char str[] = "hello world";// 编译正则表达式ret = regcomp(&regex, "hello", REG_EXTENDED);if (ret != 0)  {   printf("Error compiling regex\n");return 1;}   // 执行匹配ret = regexec(&regex, str, 0, NULL, 0); if (ret == 0) {printf("Match found\n");} else if (ret == REG_NOMATCH) {printf("No match found\n");} else {printf("Error executing regex\n");}   // 释放正则表达式regfree(&regex);return 0;
}

2.2 test-pcre.c

#include <stdio.h>
#include <string.h>
#include <pcre.h>int main() {const char *pattern = "hello (\\w+)";const char *subject = "hello world";const int subject_length = strlen(subject);const char *error;int error_offset;pcre *re = pcre_compile(pattern, 0, &error, &error_offset, NULL);if (re == NULL) {printf("PCRE compilation failed at offset %d: %s\n", error_offset, error);return 1;}   int ovector[3];int rc = pcre_exec(re, NULL, subject, subject_length, 0, 0, ovector, 3); if (rc < 0) {printf("PCRE execution failed with error code %d\n", rc);pcre_free(re);return 1;}   printf("Match found: ");for (int i = ovector[2]; i < ovector[3]; i++) {printf("%c", subject[i]);}   printf("\n");pcre_free(re);return 0;
}

3.接口说明

3.1 posix-re

       #include <sys/types.h>#include <regex.h>int regcomp(regex_t *preg, const char *regex, int cflags);int regexec(const regex_t *preg, const char *string, size_t nmatch,regmatch_t pmatch[], int eflags);size_t regerror(int errcode, const regex_t *preg, char *errbuf,size_t errbuf_size);void regfree(regex_t *preg);
DESCRIPTIONPOSIX regex compilingregcomp() is used to compile a regular expression into a form that is suitable for subsequent regexec() searches.regcomp() is supplied with preg, a pointer to a pattern buffer storage area; regex, a pointer to the null-terminated string and cflags, flags usedto determine the type of compilation.All regular expression searching must be done via a compiled pattern buffer, thus regexec() must always be supplied with the  address  of  a  reg‐comp() initialized pattern buffer.cflags may be the bitwise-or of one or more of the following:REG_EXTENDEDUse POSIX Extended Regular Expression syntax when interpreting regex.  If not set, POSIX Basic Regular Expression syntax is used.REG_ICASEDo not differentiate case.  Subsequent regexec() searches using this pattern buffer will be case insensitive.REG_NOSUBDo  not  report  position of matches.  The nmatch and pmatch arguments to regexec() are ignored if the pattern buffer supplied was compiledwith this flag set.REG_NEWLINEMatch-any-character operators don't match a newline.A nonmatching list ([^...])  not containing a newline does not match a newline.Match-beginning-of-line operator (^) matches the empty string immediately after a newline, regardless  of  whether  eflags,  the  executionflags of regexec(), contains REG_NOTBOL.Match-end-of-line operator ($) matches the empty string immediately before a newline, regardless of whether eflags contains REG_NOTEOL.POSIX regex matchingregexec()  is used to match a null-terminated string against the precompiled pattern buffer, preg.  nmatch and pmatch are used to provide informa‐tion regarding the location of any matches.  eflags may be the bitwise-or of one or both of REG_NOTBOL  and  REG_NOTEOL  which  cause  changes  inmatching behavior described below.REG_NOTBOLThe match-beginning-of-line operator always fails to match (but see the compilation flag REG_NEWLINE above) This flag may be used when dif‐ferent portions of a string are passed to regexec() and the beginning of the string should not be interpreted as the beginning of the line.REG_NOTEOLThe match-end-of-line operator always fails to match (but see the compilation flag REG_NEWLINE above)Byte offsetsUnless REG_NOSUB was set for the compilation of the pattern buffer, it is possible to obtain match addressing information.  pmatch must be  dimen‐sioned  to  have  at  least  nmatch  elements.  These are filled in by regexec() with substring match addresses.  The offsets of the subexpressionstarting at the ith open parenthesis are stored in pmatch[i].  The entire regular expression's match addresses are  stored  in  pmatch[0].   (Notethat to return the offsets of N subexpression matches, nmatch must be at least N+1.)  Any unused structure elements will contain the value -1.The regmatch_t structure which is the type of pmatch is defined in <regex.h>.typedef struct {regoff_t rm_so;regoff_t rm_eo;} regmatch_t;Each  rm_so  element  that is not -1 indicates the start offset of the next largest substring match within the string.  The relative rm_eo elementindicates the end offset of the match, which is the offset of the first character after the matching text.POSIX error reportingregerror() is used to turn the error codes that can be returned by both regcomp() and regexec() into error message strings.regerror() is passed the error code, errcode, the pattern buffer, preg, a pointer to a character string buffer, errbuf, and the size of the stringbuffer,  errbuf_size.   It  returns  the  size  of  the  errbuf  required to contain the null-terminated error message string.  If both errbuf anderrbuf_size are nonzero, errbuf is filled in with the first errbuf_size - 1 characters of the error message and a terminating null byte ('\0').POSIX pattern buffer freeingSupplying regfree() with a precompiled pattern buffer, preg will free the memory allocated to the pattern buffer by the  compiling  process,  reg‐comp().RETURN VALUEregcomp() returns zero for a successful compilation or an error code for failure.regexec() returns zero for a successful match or REG_NOMATCH for failure.ERRORSThe following errors can be returned by regcomp():REG_BADBRInvalid use of back reference operator.REG_BADPATInvalid use of pattern operators such as group or list.REG_BADRPTInvalid use of repetition operators such as using '*' as the first character.REG_EBRACEUn-matched brace interval operators.REG_EBRACKUn-matched bracket list operators.REG_ECOLLATEInvalid collating element.REG_ECTYPEUnknown character class name.REG_EENDNonspecific error.  This is not defined by POSIX.2.REG_EESCAPETrailing backslash.REG_EPARENUn-matched parenthesis group operators.REG_ERANGEInvalid use of the range operator, e.g., the ending point of the range occurs prior to the starting point.REG_ESIZECompiled regular expression requires a pattern buffer larger than 64Kb.  This is not defined by POSIX.2.REG_ESPACEThe regex routines ran out of memory.REG_ESUBREGInvalid back reference to a subexpression.

3.2 pcre

3.2.1 pcre_complie-编译正则表达式

NAMEPCRE - Perl-compatible regular expressionsSYNOPSIS#include <pcre.h>pcre *pcre_compile(const char *pattern, int options,const char **errptr, int *erroffset,const unsigned char *tableptr);pcre16 *pcre16_compile(PCRE_SPTR16 pattern, int options,const char **errptr, int *erroffset,const unsigned char *tableptr);pcre32 *pcre32_compile(PCRE_SPTR32 pattern, int options,const char **errptr, int *erroffset,const unsigned char *tableptr);DESCRIPTIONThis function compiles a regular expression into an internal form. It is the same as pcre[16|32]_compile2(), except for the absence of the errorcodeptr argument. Its arguments are:pattern       A zero-terminated string containing theregular expression to be compiledoptions       Zero or more option bitserrptr        Where to put an error messageerroffset     Offset in pattern where error was foundtableptr      Pointer to character tables, or NULL touse the built-in defaultThe option bits are:PCRE_ANCHORED           Force pattern anchoringPCRE_AUTO_CALLOUT       Compile automatic calloutsPCRE_BSR_ANYCRLF        \R matches only CR, LF, or CRLFPCRE_BSR_UNICODE        \R matches all Unicode line endingsPCRE_CASELESS           Do caseless matchingPCRE_DOLLAR_ENDONLY     $ not to match newline at endPCRE_DOTALL             . matches anything including NLPCRE_DUPNAMES           Allow duplicate names for subpatternsPCRE_EXTENDED           Ignore white space and # commentsPCRE_EXTRA              PCRE extra features(not much use currently)PCRE_FIRSTLINE          Force matching to be before newlinePCRE_JAVASCRIPT_COMPAT  JavaScript compatibilityPCRE_MULTILINE          ^ and $ match newlines within dataPCRE_NEWLINE_ANY        Recognize any Unicode newline sequencePCRE_NEWLINE_ANYCRLF    Recognize CR, LF, and CRLF as newlinesequencesPCRE_NEWLINE_CR         Set CR as the newline sequencePCRE_NEWLINE_CRLF       Set CRLF as the newline sequencePCRE_NEWLINE_LF         Set LF as the newline sequencePCRE_NO_AUTO_CAPTURE    Disable numbered capturing paren-theses (named ones available)PCRE_NO_UTF16_CHECK     Do not check the pattern for UTF-16validity (only relevant ifPCRE_UTF16 is set)PCRE_NO_UTF32_CHECK     Do not check the pattern for UTF-32validity (only relevant ifPCRE_UTF32 is set)PCRE_NO_UTF8_CHECK      Do not check the pattern for UTF-8validity (only relevant ifPCRE_UTF8 is set)PCRE_UCP                Use Unicode properties for \d, \w, etc.PCRE_UNGREEDY           Invert greediness of quantifiersPCRE_UTF16              Run in pcre16_compile() UTF-16 modePCRE_UTF32              Run in pcre32_compile() UTF-32 modePCRE_UTF8               Run in pcre_compile() UTF-8 modePCRE must be built with UTF support in order to use PCRE_UTF8/16/32 and 
PCRE_NO_UTF8/16/32_CHECK, and with UCP support if PCRE_UCP is used.The  yield  of the function is a pointer to a private data structure that 
contains the compiled pattern, or NULL if an error was detected. Note that compiling
regular expressions with one version of PCRE for use with a differentversion is not guaranteed to work and may cause crashes.There is a complete description of the PCRE native API in the pcreapi page and 
a description of the POSIX API in the pcreposix page.

3.2.2 pcre_exec-函数参数说明

 int pcre_exec(const pcre *code, const pcre_extra *extra,const char *subject, int length, int startoffset,int options, int *ovector, int ovecsize);This function matches a compiled regular expression against a given subject string, 
using a matching algorithm that is similar to Perl's. It returns offsets to captured 
substrings. Its arguments are:code         Points to the compiled patternextra        Points to an associated pcre[16|32]_extra structure,or is NULLsubject      Points to the subject stringlength       Length of the subject string, in bytesstartoffset  Offset in bytes in the subject at which tostart matchingoptions      Option bitsovector      Points to a vector of ints for result offsetsovecsize     Number of elements in the vector (a multiple of 3)The options are:PCRE_ANCHORED          Match only at the first positionPCRE_BSR_ANYCRLF       \R matches only CR, LF, or CRLFPCRE_BSR_UNICODE       \R matches all Unicode line endingsPCRE_NEWLINE_ANY       Recognize any Unicode newline sequencePCRE_NEWLINE_ANYCRLF   Recognize CR, LF, & CRLF as newline sequencesPCRE_NEWLINE_CR        Recognize CR as the only newline sequencePCRE_NEWLINE_CRLF      Recognize CRLF as the only newline sequencePCRE_NEWLINE_LF        Recognize LF as the only newline sequencePCRE_NOTBOL            Subject string is not the beginning of a linePCRE_NOTEOL            Subject string is not the end of a linePCRE_NOTEMPTY          An empty string is not a valid matchPCRE_NOTEMPTY_ATSTART  An empty string at the start of the subjectis not a valid matchPCRE_NO_START_OPTIMIZE Do not do "start-match" optimizationsPCRE_NO_UTF16_CHECK    Do not check the subject for UTF-16validity (only relevant if PCRE_UTF16was set at compile time)PCRE_NO_UTF32_CHECK    Do not check the subject for UTF-32validity (only relevant if PCRE_UTF32was set at compile time)PCRE_NO_UTF8_CHECK     Do not check the subject for UTF-8validity (only relevant if PCRE_UTF8was set at compile time)PCRE_PARTIAL           ) Return PCRE_ERROR_PARTIAL for a partialPCRE_PARTIAL_SOFT      )   match if no full matches are foundPCRE_PARTIAL_HARD      Return PCRE_ERROR_PARTIAL for a partial matchif that is found before a full match

3.2.3 pcre.h文件中的一些枚举值

这些枚举值在pcre_exec的返回值中被用到。
/* Exec-time and get/set-time error codes */#define PCRE_ERROR_NOMATCH          (-1)
#define PCRE_ERROR_NULL             (-2)
#define PCRE_ERROR_BADOPTION        (-3)
#define PCRE_ERROR_BADMAGIC         (-4)
#define PCRE_ERROR_UNKNOWN_OPCODE   (-5)
#define PCRE_ERROR_UNKNOWN_NODE     (-5)  /* For backward compatibility */
#define PCRE_ERROR_NOMEMORY         (-6)
#define PCRE_ERROR_NOSUBSTRING      (-7)
#define PCRE_ERROR_MATCHLIMIT       (-8)
#define PCRE_ERROR_CALLOUT          (-9)  /* Never used by PCRE itself */
#define PCRE_ERROR_BADUTF8         (-10)  /* Same for 8/16/32 */
#define PCRE_ERROR_BADUTF16        (-10)  /* Same for 8/16/32 */
#define PCRE_ERROR_BADUTF32        (-10)  /* Same for 8/16/32 */
#define PCRE_ERROR_BADUTF8_OFFSET  (-11)  /* Same for 8/16 */
#define PCRE_ERROR_BADUTF16_OFFSET (-11)  /* Same for 8/16 */
#define PCRE_ERROR_PARTIAL         (-12)
#define PCRE_ERROR_BADPARTIAL      (-13)
#define PCRE_ERROR_INTERNAL        (-14)
#define PCRE_ERROR_BADCOUNT        (-15)
#define PCRE_ERROR_DFA_UITEM       (-16)
#define PCRE_ERROR_DFA_UCOND       (-17)
#define PCRE_ERROR_DFA_UMLIMIT     (-18)
#define PCRE_ERROR_DFA_WSSIZE      (-19)
#define PCRE_ERROR_DFA_RECURSE     (-20)
#define PCRE_ERROR_RECURSIONLIMIT  (-21)
#define PCRE_ERROR_NULLWSLIMIT     (-22)  /* No longer actually used */
#define PCRE_ERROR_BADNEWLINE      (-23)
#define PCRE_ERROR_BADOFFSET       (-24)
#define PCRE_ERROR_SHORTUTF8       (-25)
#define PCRE_ERROR_SHORTUTF16      (-25)  /* Same for 8/16 */
#define PCRE_ERROR_RECURSELOOP     (-26)
#define PCRE_ERROR_JIT_STACKLIMIT  (-27)
#define PCRE_ERROR_BADMODE         (-28)
#define PCRE_ERROR_BADENDIANNESS   (-29)
#define PCRE_ERROR_DFA_BADRESTART  (-30)
#define PCRE_ERROR_JIT_BADOPTION   (-31)
#define PCRE_ERROR_BADLENGTH       (-32)
#define PCRE_ERROR_UNSET           (-33)

3.2.4 pcre_exec-源码实现

源码在pcre_exec.c文件中。

3.2.5 pcre_exec-函数返回值说明

该函数的返回值是一个整数,代表了匹配的结果。具体来说,
(1)返回值大于等于 0:
如果返回值为非负数,表示成功匹配,且返回值是匹配的子串数量加1。
这表示正则表达式成功匹配目标字符串,并且返回了匹配的子串数量。
返回值为0时,表示正则表达式成功匹配了目标字符串,但没有返回任何子串,即没有捕获组。(2)返回值小于0:
返回值是负数,表示匹配失败或发生了错误。
返回值为 -1('PCRE_ERROR_NOMATCH')时,表示正则表达式未能匹配目标字符串。
其他负数返回值表示发生了其他错误,可能是由于正则表达式本身的问题、目标字符串格式问题或者
内存分配问题等。
根据 'pcre_exec' 函数的返回值,可以判断正则表达式是否成功匹配目标字符串,以及获取匹配的
子串数量等信息。在实际使用中,可以根据返回值来进行适当的处理和错误检测。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/294420.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

MDO4104B-6泰克MDO4104B-6混合域示波器

181/2461/8938产品概述&#xff1a; 包含逻辑分析仪、频谱分析仪和协议分析仪的示波器 - 所有这些都同步实现集成视图。尽管您可以将泰克 MDO4000B 系列简单地用作混合信号示波器或频谱分析仪&#xff0c;但真正的威力来自于两者的集成。您有史以来第一次可以在一台仪器上看到…

接口自动化框架搭建(八):pytest+allure+jenkins接入

1&#xff0c;安装allure插件 2&#xff0c;创建jenkins项目 怎么确定路径&#xff0c;可以查看工作空间&#xff0c;jenkins默认根目录就是工作空间 配置执行用例的命令&#xff0c;可以现在pycharm上试一下&#xff0c;然后在jenkins中配置&#xff1a; 把启动java服务的代…

Flutter 开发学习笔记(0):环境配置

文章目录 前言开发需求环境配置运行出现问题我运行也是解决了很久的问题镜像源设置为清华的镜像源&#xff08;不知道有没有影响&#xff09;使用JDK17&#xff0c;测试过JDK21和JDK11都不行手动下载flutter 对应的gradle添加阿里云代理安卓编译下载 运行成功&#xff01; 前言…

双目测距项目 | 在Jetson-Nano平台上部署SGBM深度测距+YOLOv5目标检测算法

项目应用场景 面向在 Jetson Nano 平台上部署 SGBM 深度测距和基于 YOLOv5 的目标检测算法&#xff0c;实现双目测距的功能。 项目流程与效果&#xff1a; 项目细节 > 具体参见项目 README.md项目获取 https://download.csdn.net/download/weixin_42405819/89051043

【2024年5月备考新增】《2024高项论文精华版(3)考试技巧》

3 考试技巧 3.1 考试难度 考试难度上&#xff0c;越是常见的题目、越是被大家预测的题目&#xff0c;阅卷就会更严格。 越是大家猜测不到的&#xff0c;越是小众的题目&#xff0c;阅卷严格程度就会低。 3.2 技巧 1、记住软考论文的目的&#xff0c;不是为了证明你的格式严谨…

枚举---算法

1、定义 枚举算法&#xff1a;也称之为穷举算法&#xff0c;这种算法就是在解决问题的时候去使用所有的方式去解决这个问题&#xff0c;会通过推理去考虑事件发生的每一种可能&#xff0c;最后推导出结果。优点&#xff1a;简单粗暴&#xff0c;它暴力的枚举所有可能&#xff…

蓝桥杯刷题day13——乘飞机【算法赛】

一、问题描述 等待登机的你看着眼前有老有小长长的队伍十分无聊&#xff0c;你突然想要知道&#xff0c;是否存在两个年龄相仿的乘客。每个乘客的年龄用一个 0 到 36500 的整数表示&#xff0c;两个乘客的年龄相差 365 以内就认为是相仿的。 具体来说&#xff0c;你有一个长度…

数据结构——数组

数组定义&#xff1a; 在计算机科学中&#xff0c;数组是由一组元素&#xff08;值或变量&#xff09;组成的数据结构&#xff0c;每个元素有至少一个索引或键来标识。 因为数组内的元素是连续存储的&#xff0c;所以数组中元素的地址&#xff0c;可以通过其索引计算出来。 性…

问题2-前端json数组数据转换成csv文件

代码 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>将 JSON 数据导出为 CSV 文件</title> …

电子招标采购系统源码之从供应商管理到采购招投标、采购合同、采购执行的全过程数字化管理

随着市场竞争的加剧和企业规模的扩大&#xff0c;招采管理逐渐成为企业核心竞争力的重要组成部分。为了提高招采工作的效率和质量&#xff0c;我们提出了一种基于电子化平台的解决方案。该方案旨在通过电子化招投标&#xff0c;使得招标采购的质量更高、速度更快&#xff0c;同…

SMILETrack——ByteTrack与外观特征的融合实现高效的多目标跟踪方法

概述 ByteTrack在多目标跟踪领域取得了显著成就&#xff0c;但依赖运动信息&#xff08;IoU&#xff09;进行关联的机制存在局限性。为了弥补这一不足&#xff0c;SMILETrack提出一种集成了外观特征的最先进的多目标跟踪&#xff08;SoTA&#xff09;模型。 在多目标跟踪的两大…

Flutter 使用 AndroidStudio 给(Android 安卓)进行签名方法

一、使用 AndroidStudio 创建签名 使用 AndroidStudio 打开 Flutter项目中的 android 文件夹首次打开 AndroidStudio 会加载一会。菜单栏 &#xff1a; Build -> Generate Signed Bundle APK... 选中 APK -> Next点击Create new....下面按照需求填写即可- 文件夹选择 项…

Spring Boot项目启动速度优化

1、配置自动配置排除列表&#xff0c;减少启动自动配置扫描&#xff0c;配置项spring.autoconfigure.exclude 2、启动类添加索引注解Indexed&#xff0c;去除启动过程中 Components 的扫描步骤&#xff0c;直接从索引文件读取。 import org.springframework.stereotype.lndexe…

74HC595芯片工作原理(附使用方法)

一、74HC595脚位图及说明 管脚说明&#xff1a; 14脚&#xff1a;DS&#xff08;SER&#xff09;&#xff0c;串行数据输入引脚 13脚&#xff1a;OE&#xff0c;输出使能控制脚&#xff0c;它是低电才使能输出&#xff0c;所以接GND 12脚&#xff1a;RCK&#xff08;STCP&…

使用node爬取视频网站里《龙珠》m3u8视频

1. 找到视频播放网站 百度一下 龙珠视频播放 精挑细选一个可以播放的网站。 如&#xff1a;我在网上随便找了一个播放网站&#xff0c;可以直接在线播放 https://www.xxx.com/play/39999-1-7.html 这里不具体写视频地址了&#xff0c;大家可以自行搜索 2.分析网页DOM结…

Python | Leetcode Python题解之第5题最长回文子串

题目&#xff1a; 题解&#xff1a; class Solution:def expand(self, s, left, right):while left > 0 and right < len(s) and s[left] s[right]:left - 1right 1return (right - left - 2) // 2def longestPalindrome(self, s: str) -> str:end, start -1, 0s …

JMeter自定义日志与日志分析

1 JMeter日志概览 JMeter与Java程序一样&#xff0c;会记录事件日志&#xff0c;日志文件保存在bin目录中&#xff0c;名称为jmeter.log。当然&#xff0c;我们也可以在面板中直接察看日志&#xff0c;点击右上角黄色标志物可以打开日志面板&#xff0c;再次点击收起。 可见&…

从入门到实战:vue3路由知识点

本人在B站上关于vue3的尚硅谷的课程&#xff0c;以下是整理一些笔记。 1.两个知识点 1.路由组件通常存放在pages 或 views文件夹&#xff0c;一般组件通常存放在components文件夹。 组件可以分为&#xff1a; 1. 一般组件&#xff1a;亲手写标签出来的 2. 路由组件&#…

宝塔面板 -- 打包前端项目并部署提升访问速度

文章目录 前言一、打包前端项目二、添加PHP项目三、部署打包文件四、开通防火墙五、运行网站总结 前言 在前面写到的文章使用宝塔面板部署前端项目中&#xff0c;并没有将前端项目打包而是直接部署&#xff0c;导致网站访问速度非常慢&#xff0c;加载甚至要十几秒。因此&…

Linux之用户账号、用户组和与账号有关的系统文件

目录 一、基本介绍 1.用户和用户组 2.UID和GID 二、 账户管理 1.查看用户的UID和GID 2.添加账户 3.删除账号 4.修改账号 5.账户口令 三、分组管理 1.新增用户组 2.删除用户组 3.修改用户组 4.用户组切换 四、与账号有关的系统文件 1./etc/passwd 2./etc/shado…