UltraEdit正则表达式搜索替换小技巧
由于需要,要将Admodfy导出来的ldf文件内容做修改,样例如下 dn:CN = 蔡妮 , OU = ADImportOU , DC = myDomain , DC = com , DC = cn changetype:add objectClass:contact cn:蔡妮 sn:蔡妮 mailNickname:lily . cai targetAddress:lily . cai@myDomain . com
由于需要,要将Admodfy导出来的ldf文件内容做修改,样例如下
dn: CN=蔡妮,OU=AD Import OU,DC=myDomain,DC=com,DC=cn
changetype: add
objectClass: contact
cn: 蔡妮
sn: 蔡妮
mailNickname: lily.cai
targetAddress: lily.cai@myDomain.com.cn
proxyAddresses: X400:c=us;a= ;p=myDomain;o=Exchange;s=lily.cai;
proxyAddresses: SMTP:lily.cai@myDomain.com.cn
mail: lilycai@myDomain.com.cn
company: 总部
department: 财务
DisplayName: 蔡妮[Lily]
name: 蔡妮
profilePath: /ServerNameUserConf$lily.cai
要将含有X400邮件地址的行和profilePath的行删除掉,修改为
dn: CN=蔡妮,OU=AD Import OU,DC=myDomain,DC=com,DC=cn
changetype: add
objectClass: contact
cn: 蔡妮
sn: 蔡妮
mailNickname: lily.cai
targetAddress: SMTP:lily.cai@myDomain.com.cn
proxyAddresses: SMTP:lily.cai@myDomain.com.cn
mail: lily.cai@myDomain.com.cn
company: 总部
department: 财务
DisplayName: 蔡妮[Lily]
name: 蔡妮
由于文本中有大量的用户,手工删除很不现实,于是使用UltraEdit的正则表达式搜索删除,问题很快解决,用UltraEdit打开文本,首先到菜单中选择正则表达式引擎,正则表达式引擎分支位于“配置 - 搜索”之下,有如下选项:
Perl 兼容正则表达式
如果选中该选项,则编辑器将基于 Boost C++ 库使用 Perl 样式的正则表达式(当在查找/替换对话框里选中正则表达式时)。
UltraEdit 样式正则表达式
如果选中该选项,则编辑器将在查找/替换对话框里选中正则表达式时使用 UltraEdit 样式的正则表达式。
UNIX 样式正则表达式
如果选中该选项,则编辑器将在查找/替换对话框里选中正则表达式时使用 UNIX 样式的正则表达式。
选择自己喜好的正则表达式类型,不同的引擎语法不同,比如Perl兼容的正则表达式,回车是/r,而在UltraEdit风格的以及Unix兼容的回车则分别是^p和/n,下面以UltraEdit风格来说明。
选好风格后开始搜索,使用Ctrl+R弹出替换对话框,钩选“正则表达式”,搜索内容中输入 *X400*^p ,替换为空即可,点击全部替换后,则所有包含X400字样的行都被删除。
附:
正则表达式 (UltraEdit 语法):
% 匹配行首 - 表示搜索字符串必须在行首,但不包括任何选定的结果字符中的行终止字符。
$ 匹配行尾 - 表示搜索字符串必须在行尾,但不包括任何选定的结果字符中的行终止字符。
? 匹配任何除换行符的字符。
* 匹配任何除换行符外所出现的任意数量的字符。
+ 匹配一个或多个前面的字符/表达式。必须找到至少一个出现的字符。不匹配重复的换行符。
++ 0 次或多次匹配前面的字符/表达式。不匹配重复的换行符。
^b 匹配一个分页符。
^p 匹配一个换行符 (CR/LF) (段落) (DOS 文件)
^r 匹配一个换行符 (仅 CR) (段落) (MAC 文件)
^n 匹配一个换行符 (仅 LF) (段落) (UNIX 文件)
^t 匹配一个制表符
[ ] 匹配任何括号中的单个字符或范围
^{A^}^{B^} 匹配表达式 A 或 B
^ 忽略其后的正则表达式字符
相应的替换表达式是 ^x,x 的范围是 1-9。例如: 如果 ^(h*o^) ^(f*s^) 匹配“hello folks”,那么^2 ^1 表示将用“folks hello”替换它。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Win11 Tips Sharing: One trick to skip Microsoft account login Windows 11 is the latest operating system launched by Microsoft, with a new design style and many practical functions. However, for some users, having to log in to their Microsoft account every time they boot up the system can be a bit annoying. If you are one of them, you might as well try the following tips, which will allow you to skip logging in with a Microsoft account and enter the desktop interface directly. First, we need to create a local account in the system to log in instead of a Microsoft account. The advantage of doing this is

In the era dominated by intelligence, office software has also become popular, and Wps forms are adopted by the majority of office workers due to their flexibility. At work, we are required not only to learn simple form making and text entry, but also to master more operational skills in order to complete the tasks in actual work. Reports with data and using forms are more convenient, clear and accurate. The lesson we bring to you today is: The WPS table cannot find the data you are searching for. Why please check the search option location? 1. First select the Excel table and double-click to open it. Then in this interface, select all cells. 2. Then in this interface, click the "Edit" option in "File" in the top toolbar. 3. Secondly, in this interface, click "

In C language, it represents a pointer, which stores the address of other variables; & represents the address operator, which returns the memory address of a variable. Tips for using pointers include defining pointers, dereferencing pointers, and ensuring that pointers point to valid addresses; tips for using address operators & include obtaining variable addresses, and returning the address of the first element of the array when obtaining the address of an array element. A practical example demonstrating the use of pointer and address operators to reverse a string.

We often create and edit tables in excel, but as a novice who has just come into contact with the software, how to use excel to create tables is not as easy as it is for us. Below, we will conduct some drills on some steps of table creation that novices, that is, beginners, need to master. We hope it will be helpful to those in need. A sample form for beginners is shown below: Let’s see how to complete it! 1. There are two methods to create a new excel document. You can right-click the mouse on a blank location on the [Desktop] - [New] - [xls] file. You can also [Start]-[All Programs]-[Microsoft Office]-[Microsoft Excel 20**] 2. Double-click our new ex

VSCode (Visual Studio Code) is an open source code editor developed by Microsoft. It has powerful functions and rich plug-in support, making it one of the preferred tools for developers. This article will provide an introductory guide for beginners to help them quickly master the skills of using VSCode. In this article, we will introduce how to install VSCode, basic editing operations, shortcut keys, plug-in installation, etc., and provide readers with specific code examples. 1. Install VSCode first, we need

Golang regular expressions use the pipe character | to match multiple words or strings, separating each option as a logical OR expression. For example: matches "fox" or "dog": fox|dog matches "quick", "brown" or "lazy": (quick|brown|lazy) matches "Go", "Python" or "Java": Go|Python |Java matches words or 4-digit zip codes: ([a-zA

Want to know what the Excel search shortcut key is? The answer is simple, just use [Ctrl+F] to perform a quick search. We often use Excel to record a lot of different data and names. If we need to change it, it will be inconvenient for us to search because there is too much data, and it will be quite troublesome to search. In fact, we can use a quick search shortcut to find the data we need to change! So, what is the search shortcut key in Excel? Today I’m going to teach you how to use the shortcut search keys in excel tables to save you time and effort in your work. Here I am using this version of Microsoft Office excel 2010 for demonstration. Students who need it can

Alibaba Cloud Disk, this popular storage tool, not only helps us manage personal resources efficiently, but also provides many convenient functions. So many users may not be able to find cloud disk resources when searching, so they want to search all resources in the entire disk. So below, the editor of this site will answer this question in detail and share the specific search method. Users who want to know, please come and follow this article to learn more! How to search other people's resources in Alibaba Cloud Disk 1. First, search the specific path of the resource file in the folder directory of Alibaba Cloud Disk to find the corresponding folder. 2. Then use the file search function and enter the keywords you want to find to find the relevant file content. 3. Then we share the link with others to directly locate and download
