1 Word count (10 points)Topic content:Your program reads an English article and then counts the number of words to output. The data to be counted are:
The total number of words;
The number of words that contain 1 letters to 10 letters.
The spacing between words and words is formed by the following punctuation marks: spaces, tabs, carriage returns, commas, periods, question marks, parentheses, double quotes, and colons. These symbols
characters, not hyphens, more winners, or no separators at all, or 7 digits together. In these cases, we can use (-|)? To solve. The regular expression of this structure is the converter, which can match several of the above mentioned cases. When () can contain a pipe character |, it can match whether it contains a space character or a hyphen, and the tail of the "metacharacters" indicates whether there is no delimiter at all. Finally, the location n
template, matches a character pattern to the string you are searching for.Here are some examples of regular expressions that you might encounter:CodeJScript VBScript Matching/^\[\t]*$/"^\[\t]*$" matches a blank line./\d{2}-\d{5}/"\d{2}-\d{5}" verifies whether an ID number consists of a 2-digit number, a hyphen, and a 5-digit number./The following table is a complete list of metacharacters and its behavior in the context of regular expressions:Charact
is just a chestnut), then we can write a regular expression to match it: \d{18}, or for example, our bank card withdrawal password, generally 6 digits, then we can write: \d{6} to match a regular expression like this.{n,}: Repeat N or more times (that is, at least repeat n times)For example: Now many Web site account registration, password requirements not less than how many number, then we can write: \d{6,}, this is not less than 6 digits{n,m}: Repeats N to M times (repeats at least n times, u
definitions, such as functions or class definitions. method definition, the class definition and the first method should be empty lines. In a function or method, there is a blank line in some places if you feel fit.Spaceuse spaces on both sides of punctuation according to standard typographic specifications1. Do not include spaces in parentheses. Yes:spam (ham[1],{eggs:2},[]) no:spam (ham[1],{eggs: 2},[]) 2. Do not precede commas, semicolons, and col
)*: Match any number or no single character before it, for example:. Represents any character, the. * matches any length of any character^: matches the regular expression immediately following it, the BRE only has a special meaning at the beginning of the regular expression, and Ere has special meanings in any position$: Matches the preceding regular expression, at the end of the string or line. The BRE has a special meaning only at the end of the regular expression, and Ere has a special meanin
interpreted languagesInteractive command-line IDENaming rules:variable names can only be any combination of letters, numbers, or underscores the first character cannot be a number 1. The length of the variable name is unrestricted, but the character must be a letter, a number, or an underscore (_), not a space, hyphen, punctuation, quotation mark, or other character.2. The first character of a variable nam
file line will have a filename plus a colon to identify which file it came from.You can use multiple-e or-f options to create a list of patterns to find.Regular Expressions:Related information: Http://zh.wikipedia.org/wiki/%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8Fis the pattern written by a class of characters, many of which do not represent their literal meaning, but rather the functions of expression control or wildcard;Metacharactersdoes not represent its literal meaning, but is used for
{2}-\d{5}/"\d{2}-\d{5}" verifies that an ID number consists of a 2-digit number, a hyphen, and a 5-digit number.
/
The following table is a complete list of metacharacters and its behavior in the context of regular expressions:
Character description
\ marks the next character as a special character, or a literal character, or a backward reference, or a octal escape character. For example, ' n ' matches the character ' n '. ' \ n ' matches a newline
Log
the summary of regular expression learning2011.7.28 Reading (8)
Debugging Tools: RegexbuddyRegular expression meta characters Total 12: $ () * +. ? [ \ ^ { |Note: The above list does not contain a closing bracket], hyphen-, right curly brace}1.],-only to be a meta character only if it is not escaped2.} is only a meta character if it is not escaped3. There is no need to escape at any time from the line4. The start and end of the chara
reset point. 5. Reverse Detection: it would be a tragedy if Liu Xiang ran the reverse track during the competition! Accurate Detection reversely let it go south, never to the north 6, calculate the total length of the track: this does not need to be explained... 7. Plug-ins are used for the time being for so many examples. The basic racing games I provide are enough. I cannot make a game for you, right? It makes no sense, continue expansion by yourselfPlug-in advantages: 1. fast and precise pat
1. Insert an optional hyphen
The steps to insert an optional hyphen in the middle of an English word in a Word2010 document are described below:
Step 1th, open the Word2010 document window and position the insertion point cursor in the middle of an English word that needs to be inserted into an optional hyphen.
Step 2nd, switch to the Insert Ribbon, click the
a match is found, the sarh method returns an integer indicating the offset position starting from the string. If no match is found,-1 is returned.
Example \\The following example demonstrates the use of the sarh method.Funtin Sarhm () {var r, r; // declare the variable. Var s = "Th rain in Spain falls mainly in th plain."; r =/falls/I; // create a regular expression pattern. R = s. sarh (r); // search for strings. Rturn (r); // return the Blan result. }Return Value: 18
Regular expression syntax
Mysql regular expressions I personally think that the regular expressions in other program scripts are not much different in usage and rules. Next I will summarize some of the mysql Regular Expressions and instance methods.
"." Matches any single character.
A character class "[...]" matches any character in square brackets. For example, "[abc]" matches "a", "B", or "c ". To name a range of characters, use a hyphen (-). "[A-z]" matches any lowercase le
what is a character cluster?
In programs in the Internet, regular expressions are often used to validate the user's input. When the user submits a form, to determine whether the input phone number, address, email address, credit card number, etc. is valid, with ordinary literal-based characters is not enough.
So to use a more liberal way of describing the pattern we want, it's a character cluster. To create a character cluster that represents all vowel characters, place all the vowels in a squ
that the pattern matches only those strings that begin with once. For example, the pattern matches the string "Once Upon a Time" and does not match "there once is a man from NewYork". Just as the ^ symbol represents the beginning, the $ symbol is used to match strings that end in a given pattern.
bucket$
This pattern matches the "who kept all of the cash in a bucket" and does not match "buckets". The characters ^ and $ are used together to indicate exact matches (the string is the same as the
characters..(Point) matches any single character, except NULL.*Match any number of characters (can be 0 ). In the case of ERE, this prefix is a regular expression, as shown in figure.*Represents the length of matching any character. But for BRE,*Placed in the first character of the regular expression does not have any special meaning.^(Remove font size) matches an empty string at the beginning of the line or the start of the string.ERE: It has a special meaning in any position;BRE: It has this
only backslashes \ Hold special meanings for escaping characters. Other special Furus numbers, plus signs, and various parentheses are all common characters. The caret ^ if present in the first place indicates a negative character set, if it appears in the string only as ordinary characters. Hyphen-Indicates a character range description if it appears in a string, or only as a normal character if it appears in the first place.[^XYZ] Exclusion type (n
indicates that the pattern matches only those strings that begin with once. For example, the pattern matches the string "Once Upon a Time" and does not match "there once is a man from NewYork". Just as the ^ symbol represents the beginning, the $ symbol is used to match strings that end in a given pattern.
bucket$
This pattern matches the "who kept all of the cash in a bucket" and does not match "buckets". The characters ^ and $ are used together to indicate exact matches (the string is the s
1881. Long problem statementtime limit: 0.5 second
Memory limit: 64 mbwhile Fedya was writing the Statement of the problem
Gov Chronicles, He realized that there might be not enough paper to print the statements. he also discovered that his text editor didn't have the feature of calculating the number of pages in a text. then Fedya decided to write a program that wocould calculate the number of pages for any given text. fedya knew that there were
HLines on each page and
WSymbols in each line. an
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.