Thứ Ba, 29 tháng 11, 2011

Các ký tự siêu thường dùng (vô cùng quan trọng cần phải nắm)

. : đại diện cho 1 ký tự bất kỳ trừ ký tự xuống dòng \n.
\d : ký tự chữ số tương đương [0-9]
\D : ký tự ko phải chữ số
\s : ký tự khoảng trắng tương đương [ \f\n\r\t\v]
\S : ký tự không phải khoảng trắng tương đương [ ^\f\n\r\t\v]
\w : ký tự word (gồm chữ cái và chữ số, dấu gạch dưới _ ) tương đương [a-zA-Z_0-9]
\W : ký tự không phải ký tự word tương đương [^a-zA-Z_0-9]
^ : bắt đầu 1 chuỗi hay 1 dòng
$ : kết thúc 1 chuỗi hay 1 dòng
\A : bắt đầu 1 chuỗi
\z : kết thúc 1 chuỗi
| : ký tự ngăn cách so trùng tương đương với phép or (lưu ý cái này nếu muốn kết hợp nhiều điều kiện)
[abc] : khớp với 1 ký tự nằm trong nhóm là a hay b hay c.
[a-z] so trùng với 1 ký tự nằm trong phạm vi a-z, dùng dấu - làm dấu ngăn cách.
[^abc] sẽ không so trùng với 1 ký tự nằm trong nhóm, ví dụ không so trùng với a hay b hay c.
() : Xác định 1 group (biểu thức con) xem như nó là một yếu tố đơn lẻ trong pattern .ví dụ ((a(b))c) sẽ khớp với b, ab, abc.
? : khớp với đứng trước từ 0 hay 1 lần. Ví dụ A?B sẽ khớp với B hay AB.
* : khớp với đứng trước từ 0 lần trở lên . A*B khớp với B, AB, AAB
+ : khớp với đứng trước từ 1 lần trở lên. A+B khớp với AB, AAB.
{n} : n là con số, Khớp đúng với n ký tự đúng trước nó . Ví dụ A{2}) khớp đúng với 2 chữ A.
{n, } : khớp đúng với n ký tự trở lên đứng trước nó , A{2,} khớp vói AA, AAA ...
{m,n} : khớp đùng với từ m->n ký tự đứng trước nó, A{2,4} khớp vói AA,AAA,AAAA.

Learn Regular Expression (Regex) syntax with C# and .NET

What are Regular Expressions?
Regular Expressions are a powerful pattern matching language that is part of many modern programming languages. Regular Expressions allow you to apply a pattern to an input string and return a list of the matches within the text. Regular expressions also allow text to be replaced using replacement patterns. It is a very powerful version of find and replace.
There are two parts to learning Regular Expressions;
learning the Regex syntax
learning how to work with Regex in your programming language
This article introduces you to the Regular Expression syntax. After learning the syntax for Regular Expressions you can use it many different languages as the syntax is fairly similar between languages.
Microsoft's .NET Framework contains a set of classes for working with Regular Expressions in the System.Text.RegularExpressions namespace.
Download the Regular Expression Designer
When learning Regular Expressions, it helps to have a tool that you can use to test Regex patterns. Rad Software has a Free Regular Expression Tool available for download that will help as you go through the article.
The basics - Finding text
Regular Expressions are similar to find and replace in that ordinary characters match themselves. If I want to match the word "went" the Regular Expression pattern would be "went".
Text: Anna Jones and a friend went to lunch
Regex: went
Matches: Anna Jones and a friend went to lunch
went
The following are special characters when working with Regular Expressions. They will be discussed throughout the article.
. $ ^ { [ ( | ) * + ? \
Matching any character with dot
The full stop or period character (.) is known as dot. It is a wildcard that will match any character except a new line (\n). For example if I wanted to match the 'a' character followed by any two characters.
Text: abc def ant cow
Regex: a..
Matches: abc def ant cow
abc
ant
If the Singleline option is enabled, a dot matches any character including the new line character.
Matching word characters
Backslash and a lowercase 'w' (\w) is a character class that will match any word character. The following Regular Expression matches 'a' followed by two word characters.
Text: abc anaconda ant cow apple
Regex: a\w\w
Matches: abc anaconda ant cow apple
abc
ana
ant
app
Backslash and an uppercase 'W' (\W) will match any non-word character.
Matching white-space
White-space can be matched using \s (backslash and 's'). The following Regular Expression matches the letter 'a' followed by two word characters then a white space character.
Text: "abc anaconda ant"
Regex: a\w\w\s
Matches:
"abc "
Note that ant was not matched as it is not followed by a white space character.
White-space is defined as the space character, new line (\n), form feed (\f), carriage return (\r), tab (\t) and vertical tab (\v). Be careful using \s as it can lead to unexpected behaviour by matching line breaks (\n and \r). Sometimes it is better to explicitly specify the characters to match instead of using \s. e.g. to match Tab and Space use [\t\0x0020]
Matching digits
The digits zero to nine can be matched using \d (backslash and lowercase 'd'). For example, the following Regular Expression matches any three digits in a row.
Text: 123 12 843 8472
Regex: \d\d\d
Matches: 123 12 843 8472
123
843
847
Matching sets of single characters
The square brackets are used to specify a set of single characters to match. Any single character within the set will match. For example, the following Regular Expression matches any three characters where the first character is either 'd' or 'a'.
Text: abc def ant cow
Regex: [da]..
Matches: abc def ant cow
abc
def
ant
The caret (^) can be added to the start of the set of characters to specify that none of the characters in the character set should be matched. The following Regular Expression matches any three character where the first character is not 'd' and not 'a'.
Text: abc def ant cow
Regex: [^da]..
Matches:
"bc "
"ef "
"nt "
"cow"
Matching ranges of characters
Ranges of characters can be matched using the hyphen (-). the following Regular Expression matches any three characters where the second character is either 'a', 'b', 'c' or 'd'.
Text: abc pen nda uml
Regex: .[a-d].
Matches: abc pen nda uml
abc
nda
Ranges of characters can also be combined together. the following Regular Expression matches any of the characters from 'a' to 'z' or any digit from '0' to '9' followed by two word characters.
Text: abc no 0aa i8i
Regex: [a-z0-9]\w\w
Matches: abc no 0aa i8i
abc
0aa
i8i
The pattern could be written more simply as [a-z\d]
Specifying the number of times to match with Quantifiers
Quantifiers let you specify the number of times that an expression must match. The most frequently used quantifiers are the asterisk character (*) and the plus sign (+). Note that the asterisk (*) is usually called the star when talking about Regular Expressions.
Matching zero or more times with star (*)
The star tells the Regular Expression to match the character, group, or character class that immediately precedes it zero or more times. This means that the character, group, or character class is optional, it can be matched but it does not have to match. The following Regular Expression matches the character 'a' followed by zero or more word characters.
Text: Anna Jones and a friend owned an anaconda
Regex: a\w*
Options: IgnoreCase
Matches: Anna Jones and a friend owned an anaconda
Anna
and
a
an
anaconda
Matching one or more times with plus (+)
The plus sign tells the Regular Expression to match the character, group, or character class that immediately precedes it one or more times. This means that the character, group, or character class must be found at least once. After it is found once it will be matched again if it follows the first match. The following Regular Expression matches the character 'a' followed by at least one word character.
Text: Anna Jones and a friend owned an anaconda
Regex: a\w+
Options: IgnoreCase
Matches: Anna Jones and a friend owned an anaconda
Anna
and
an
anaconda
Note that "a" was not matched as it is not followed by any word characters.
Matching zero or one times with question mark (?)
To specify an optional match use the question mark (?). The question mark matches zero or one times. The following Regular Expression matches the character 'a' followed by 'n' then optionally followed by another 'n'.
Text: Anna Jones and a friend owned an anaconda
Regex: an?
Options: IgnoreCase
Matches: Anna Jones and a friend owned an anaconda
An
a
an
a
an
an
a
a
Specifying the number of matches
The minimum number of matches required for a character, group, or character class can be specified with the curly brackets ({n}). The following Regular Expression matches the character 'a' followed by a minimum of two 'n' characters. There must be two 'n' characters for a match to occur.
Text: Anna Jones and Anne owned an anaconda
Regex: an{2}
Options: IgnoreCase
Matches: Anna Jones and Anne owned an anaconda
Ann
Ann
A range of matches can be specified by curly brackets with two numbers inside ({n,m}). The first number (n) is the minimum number of matches required, the second (m) is the maximum number of matches permitted. This Regular Expression matches the character 'a' followed by a minimum of two 'n' characters and a maximum of three 'n' characters.
Text: Anna and Anne lunched with an anaconda annnnnex
Regex: an{2,3}
Options: IgnoreCase
Matches: Anna and Anne lunched with an anaconda annnnnex
Ann
Ann
annn
The Regex stops matching after the maximum number of matches has been found.
Matching the start and end of a string
To specify that a match must occur at the beginning of a string use the caret character (^). For example, I want a Regular Expression pattern to match the beginning of the string followed by the character 'a'.
Text: an anaconda ate Anna Jones
Regex: ^a
Matches: an anaconda ate Anna Jones
"a" at position 1
The pattern above only matches the a in "an".
Note that the caret (^) has different behaviour when used inside the square brackets.
If the Multiline option is on, the caret (^) will match the beginning of each line in a multiline string rather than only the start of the string.
To specify that a match must occur at the end of a string use the dollar character ($). If the Multiline option is on then the pattern will match at the end of each line in a multiline string. This Regular Expression pattern matches the word at the end of the line in a multiline string.
Text: "an anaconda
ate Anna
Jones"
Regex: \w+$
Options: Multiline, IgnoreCase
Matches:
Jones
Microsoft have an online reference for Regex in .NET: Regular Expression Syntax on MSDN
To learn more about Regular Expression syntax see the next article: C# Regular Expression (Regex) Examples in .NET

Thứ Năm, 17 tháng 11, 2011

1 Số lệnh trong Run

1. Character Map = charmap.exe (rất hữu dụng trong việc tìm kiếm các ký tự không thông dụng)
2. Disk Cleanup = cleanmgr.exe (dọn dẹp đĩa để tăng dung lượng trống)
3. Clipboard Viewer = clipbrd.exe (Xem nội dung của Windows clipboard)
4. Dr Watson = drwtsn32.exe (Công cụ gỡ rối)
5. DirectX diagnosis = dxdiag.exe (Chẩn đoán và thử DirectX, card màn hình & card âm thanh)
6. Private character editor = eudcedit.exe (cho phép tạo ra hoặc sửa đổi các ký tự(nhân vật?))
7. IExpress Wizard = iexpress.exe (Tạo ra các file nén tự bung hoặc các file tự cài đặt)
8. Mcft Synchronization Manager = mobsync.exe (cho phép đồng bộ hóa thư mục trên mạng cho làm việc Offline. Không được cung cấp tài liệu rõ ràng).
9. Windows Media Player 5.1 = mplay32.exe (phiên bản cũ của Windows Media Player, rất cơ bản).
10. ODBC Data Source Administrator = odbcad32.exe (Làm một số việc với các cơ sở dữ liệu)
11. Object Packager = packager.exe (Làm việc với các đối tượng đóng gói cho phép chèn file vào, có các file trợ giúp toàn diện).
12. System Monitor = perfmon.exe (rất hữu ích, công cụ có tính cấu hình rất cao, cho bạn biết mọi thứ bạn muốn biết về bất kỳ khía cạnh nào của hiệu suất PC, for uber-geeks only )
13. Program Manager = progman.exe (Legacy Windows 3.x desktop shell).
14. Remote Access phone book = rasphone.exe (Tài liệu là ảo, không tồn tại).
15. Registry Editor = regedt32.exe [also regedit.exe] (dành cho việc chỉnh sửa Windows Registry).
16. Network shared folder wizard = shrpubw.exe (Tạo các thư mục được chia sẻ trên mạng).
17. File siganture verification tool = sigverif.exe
18. Volume Contro = sndvol32.exe (Tôi bổ sung cái này cho những người bị mất nó từ vùng cảnh báo của hệ thống).
19. System Configuration Editor = sysedit.exe (Sửa đổi System.ini & Win.ini giống như Win98! ).
20. Syskey = syskey.exe (bảo mật cơ sở dữ liệu tài khoản WinXP – cẩn thận khi sử dụng, Nó không được cung cấp tài liệu nhưng hình như nó mã hóa tất cả các mật khẩu, Tôi không chắc về chức năng đầy đủ của nó).
21. Mcft Telnet Client = telnet.exe
22. Driver Verifier Manager = verifier.exe (có vẻ như là một tiện ích theo dõi hoạt động của các Driver(trình điều khiển) phần cứng ,có thể hữu ích đối với người gặp sự cố với các Driver. Khộng được cung cấp tài liệu)
23. Windows for Workgroups Chat = winchat.exe (Xuất hiện như là 1 tiện ích WinNT cũ cho phép chat trong mạng LAN,có file trợ giúp).
24. System configuration = msconfig.exe (Có thể sử dụng để quản lý các chương trình khởi động cùng với Windows)
25. gpedit.msc được sử dụng để quản lý các chính sách nhóm và các quyền hạn.
here are more 99 commands
Accessibility Controls: access.cpl
Add Hardware Wizard: hdwwiz.cpl
Add/Remove Programs:cappwiz.cpl
Administrative Tools: control admintools
Automatic Updates: wuaucpl.cpl
Bluetooth Transfer Wizard: fsquirt
Calculator: calc
Certificate Manager: certmgr.msc
Character Map: charmap
Check Disk Utility:chkdsk
Clipboard Viewer: clipbrd
Command Prompt: cmd
Component Services: dcomcnfg
Computer Management: compmgmt.msc
Date and Time Properties: timedate.cpl
DDE Shares: ddeshare
Device Manager: devmgmt.msc
Direct X Control Panel (If Installed)*: directx.cpl
Direct X Troubleshooter: dxdiag
Disk Cleanup Utility: cleanmgr
Disk Defragment: dfrg.msc
Disk Management: diskmgmt.msc
Disk Partition Manager: diskpart
Display Properties: control desktop
Display Properties: desk.cpl
Display Properties (w/Appearance Tab Preselected): control color
Dr. Watson System Troubleshooting Utility: drwtsn32
Driver Verifier Utility: verifier
Event Viewer: eventvwr.msc
File Signature Verification Tool: sigverif
Findfast: findfast.cpl
Folders Properties: control folders
Fonts: control fonts
Fonts Folder: fonts
Free Cell Card Game: freecell
Game Controllers: joy.cpl
Group Policy Editor (XP Prof): gpedit.msc
Hearts Card Game: mshearts
Iexpress Wizard: iexpress
Indexing Service: ciadv.msc
Internet Properties: inetcpl.cpl
IP Configuration (Display Connection Configuration): ipconfig /all
IP Configuration (Display DNS Cache Contents): ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents): ipconfig /flushdns
IP Configuration (Release All Connections): ipconfig /release
IP Configuration (Renew All Connections): ipconfig /renew
IP Configuration (Refreshes DHCP & Re-Registers DNS): ipconfig /registerdns
IP Configuration (Display DHCP Class ID): ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID): ipconfig /setclassid
ava Control Panel (If Installed): jpicpl32.cpl
Java Control Panel (If Installed): javaws
Keyboard Properties: control keyboard
Local Security Settings: secpol.msc
Local Users and Groups: lusrmgr.msc
Logs You Out Of Windows: logoff
Microsoft Chat: winchat
Minesweeper Game: winmine
Mouse Properties: control mouse
Mouse Properties: main.cpl
Network Connections: control netconnections
Network Connections: ncpa.cpl
Network Setup Wizard: netsetup.cpl
Notepad: notepad
Nview Desktop Manager (If Installed): nvtuicpl.cpl
Object Packager: packager
ODBC Data Source Administrator: odbccp32.cpl
On Screen Keyboard: osk
Opens AC3 Filter (If Installed): ac3filter.cpl
Password Properties: password.cpl
Performance Monitor: perfmon.msc
Performance Monitor: perfmon
Phone and Modem Options: telephon.cpl
Power Configuration: powercfg.cpl
Printers and Faxes: control printers
Printers Folder: printers
Private Character Editor: eudcedit
Quicktime (If Installed): QuickTime.cpl
Regional Settings: intl.cpl
Registry Editor: regedit
Registry Editor: regedit32
emote Desktop: mstsc
Removable Storage: ntmsmgr.msc
Removable Storage Operator Requests: ntmsoprq.msc
Resultant Set of Policy (XP Prof): rsop.msc
Scanners and Cameras: sticpl.cpl
Scheduled Tasks: control schedtasks
Security Center: wscui.cpl
Services: services.msc
Shared Folders: fsmgmt.msc
Shuts Down Windows: shutdown
Sounds and Audio: mmsys.cpl
Spider Solitare Card Game: spider
SQL Client Configuration: cliconfg
System Configuration Editor: sysedit
System Configuration Utility: msconfig
System File Checker Utility (Scan Immediately): sfc /scannow
System File Checker Utility (Scan Once At Next Boot): sfc /scanonce
System File Checker Utility (Scan On Every Boot): sfc /scanboot
System File Checker Utility (Return to Default Setting): sfc /revert
System File Checker Utility (Purge File Cache): sfc /purgecache
System File Checker Utility (Set Cache Size to size x): sfc /cachesize=x
System Properties: sysdm.cpl
Task Manager:taskmgr
Telnet Client:telnet
User Account Management:nusrmgr.cpl
Utility Manager:utilman
Windows Firewall:firewall.cpl
Windows Magnifier:magnify
Windows Management Infrastructure:wmimgmt.msc
Windows System Security Tool:syskey
Windows Update Launches:wupdmgr
Windows XP Tour Wizard:tourstart

117 CÂU LỆNH TRONG CMD

1. Accessibility Controls – access.cpl
2. Accessibility Wizard – accwiz
3. Add Hardware Wizard – hdwwiz.cpl
4. Add/Remove Programs – appwiz.cpl
5. Administrative Tools – control admintools
6. Automatic Updates – wuaucpl.cpl
7. Bluetooth Transfer Wizard – fsquirt
8. Calculator – calc
9. Certificate Manager – certmgr.msc
10. Character Map – charmap
11. Check Disk Utility – chkdsk
12. Clipboard Viewer – clipbrd
13. Command Prompt – cmd
14. Component Services – dcomcnfg
15. Computer Management – compmgmt.msc
16. Control Panel – control
17. Date and Time Properties – timedate.cpl
18. DDE Shares – ddeshare
19. Device Manager – devmgmt.msc
20. Direct X Troubleshooter – dxdiag
21. Disk Cleanup Utility – cleanmgr
22. Disk Defragment – dfrg.msc
23. Disk Management – diskmgmt.msc
24. Disk Partition Manager – diskpart
25. Display Properties – control desktop
26. Display Properties – desk.cpl
27. Dr. Watson System Troubleshooting Utility – drwtsn32
28. Driver Verifier Utility – verifier
29. Event Viewer – eventvwr.msc
30. Files and Settings Transfer Tool – migwiz
31. File Signature Verification Tool – sigverif
32. Findfast – findfast.cpl
33. Firefox – firefox
34. Folders Properties – control folders
35. Fonts – control fonts
36. Fonts Folder – fonts
37. Free Cell Card Game – freecell
38. Game Controllers – joy.cpl
39. Group Policy Editor (for xp professional) – gpedit.msc
40. Hearts Card Game – mshearts
41. Help and Support – helpctr
42. HyperTerminal – hypertrm
43. Iexpress Wizard – iexpress
44. Indexing Service – ciadv.msc
45. Internet Connection Wizard – icwconn1
46. Internet Explorer – iexplore
47. Internet Properties – inetcpl.cpl
48. Keyboard Properties – control keyboard
49. Local Security Settings – secpol.msc
50. Local Users and Groups – lusrmgr.msc
51. Logs You Out Of Windows – logoff
52. Malicious Software Removal Tool – mrt
53. Microsoft Chat – winchat
54. Microsoft Movie Maker – moviemk
55. Microsoft Paint – mspaint
56. Microsoft Syncronization Tool – mobsync
57. Minesweeper Game – winmine
58. Mouse Properties – control mouse
59. Mouse Properties – main.cpl
60. Netmeeting – conf
61. Network Connections – control netconnections
62. Network Connections – ncpa.cpl
63. Network Setup Wizard – netsetup.cpl
64. Notepad notepad
65. Object Packager – packager
66. ODBC Data Source Administrator – odbccp32.cpl
67. On Screen Keyboard – osk
68. Outlook Express – msimn
69. Paint – pbrush
70. Password Properties – password.cpl
71. Performance Monitor – perfmon.msc
72. Performance Monitor – perfmon
73. Phone and Modem Options – telephon.cpl
74. Phone Dialer – dialer
75. Pinball Game – pinball
76. Power Configuration – powercfg.cpl
77. Printers and Faxes – control printers
78. Printers Folder – printers
79. Regional Settings – intl.cpl
80. Registry Editor – regedit
81. Registry Editor – regedit32
82. Remote Access Phonebook – rasphone
83. Remote Desktop – mstsc
84. Removable Storage – ntmsmgr.msc
85. Removable Storage Operator Requests – ntmsoprq.msc
86. Resultant Set of Policy (for xp professional) – rsop.msc
87. Scanners and Cameras – sticpl.cpl
88. Scheduled Tasks – control schedtasks
89. Security Center – wscui.cpl
90. Services – services.msc
91. Shared Folders – fsmgmt.msc
92. Shuts Down Windows – shutdown
93. Sounds and Audio – mmsys.cpl
94. Spider Solitare Card Game – spider
95. SQL Client Configuration – cliconfg
96. System Configuration Editor – sysedit
97. System Configuration Utility – msconfig
98. System Information – msinfo32
99. System Properties – sysdm.cpl
100. Task Manager – taskmgr
101. TCP Tester – tcptest
102. Telnet Client – telnet
103. User Account Management – nusrmgr.cpl
104. Utility Manager – utilman
105. Windows Address Book – wab
106. Windows Address Book Import Utility – wabmig
107. Windows Explorer – explorer
108. Windows Firewall – firewall.cpl
109. Windows Magnifier – magnify
110. Windows Management Infrastructure – wmimgmt.msc
111. Windows Media Player – wmplayer
112. Windows Messenger – msmsgs
113. Windows System Security Tool – syskey
114. Windows Update Launches – wupdmgr
115. Windows Version – winver
116. Windows XP Tour Wizard – tourstart
117. Wordpad – write