When sending a short message on the site today, you may encounter a function that is to perform a wildcard search for an account.
The following situations may be used for search:
Sunzhongshan string searches without wildcards
Sun * starts with sun
* Shan ends with shan.
Sun * shan starts with sun and ends with shan
* Zhong * contains zhong
Sun * ong * starts with sun and contains ong
The first thought is to make a judgment. If it starts with "*", how
1. Create a new Web project, click the project right click Add Struts in the project.2. Create a new package in the project, create a new class and inherit the Actionsupport. The code is as follows:Package com.cn.eud;Import Com.opensymphony.xwork2.ActionSupport;public class Studentaction extends Actionsupport {Public String Add () {return SUCCESS;}Public String Delete () {return SUCCESS;}}3. Create a new two JSP page in Webwoot. In the JSP page must add 4. Be sure to match the case when you conf
The WEB server is Nginx, and you want to configure a generic subdomain name resolution. In fact, a little modification, configure a pan-domain name resolution is not difficult. Does not affect the primary domain name, domain.com and www.domain.com root is still the WWW directoryThe subdomain sub.domain.com's root wants to be placed in the Www-sub directory, and the other sub domains are equally Solution and Analysis In the Nginx configuration file, make the following configuration (schematic): s
SQL Server: SQL like wildcard special usage: Escape
%: Match zero or multiple arbitrary characters; _: match any single character; []: match a range; [^]: exclude a range
symbol
meaning
like '5 [%] '
5%
like '[_] n'
_ n
like '[A-CdF]'
A, B, C, D, or F
like '[-ACDF]'
-, A, C, D, or F
like '[[]'
[
like ']'
]
* Match any number of characters,. Match a single characterThe key is the case of *, if you encounter an asterisk, then you need to enumerate all cases that match the asterisk, including the case of an empty stringFirst, recursive solution1 Booleanismrecursive (String s,string p) {2 if(S.compareto ("") ==0)returnP.compareto ("") ==0;3 if(P.charat (0) = = ' * '){4 for(intI=0;i){5 if(IsM (S.substring (i), p))return true;6 }7 return false;8}Else{9
The day before yesterday, wildcard matching did not have an AC. Today, we went on to use dynamic planning. Repeat the question:
'? 'Match any character, '*' match any length string
Some examples:isMatch("aa","a") → falseisMatch("aa","aa") → trueisMatch("aaa","aa") → falseisMatch("aa", "*") → trueisMatch("aa", "a*") → trueisMatch("ab", "?*") → trueisMatch("aab", "c*a*b") → false
The table design is also straightforward. Enter two strings S and P. Assum
//
All elements whose paths end with the specified sub-path after "//"
// E
All Eelements. The result is all three Eelements.
// C/E
All the eElements whose parent node is C are Eelements whose id values are e1 and e2.
*
Path wildcard
/A/B/C /*
Element A → Element B → all child elements under Element C, that
----- Edit by ZhuSenlin HDU
The wildcard matching algorithm is designed. The * number can match any number of characters ,? Can match any character. For example, 12345, 12 *, and 12 *? And 12*4? And so on.
Function prototype: bool match (const char * str, const char * strpattern );
Analysis: use dynamic planning to solve the problem.
This question is similar to that of LCS. Assume that string A [I] represents the first I + 1 substring, and string B [
_ Match with any single character% Matches a string that contains one or more characters.[] Matches any single character in a specific range (for example, [a-f]) or a specific set (for example, [abcdef.[^] Matches any single character other than a specific range (for example, [^ a-f]) or a specific set (for example, [^ abcdef.For more information about how to use the like character and add the SQL wildcard, see:A. Like 'mc % 'searches all strings star
Label: style blog HTTP color Io OS Div SP CTI Package Name = "Default" Namespace = "/" Extends = "Struts-Default" > Action Name = "*_*" Class = "Com. Base. Demo. {1} action" Method = "{2 }" > {1} and {2} represent the first * and the second * respectively * --> Result > /{1}. jsp Result > Action > Package > In this way, enter the URL: Http: // localhost: 8080/struts2_0100_introduction/hello_add; //
Go to: Really interesting Web (http://www.zu14.cn)
ArticleLink: http://www.zu14.cn/2009/12/31/iis-defend-sql-injection-tools/trackback/
SQL injection is currently a major threat. To prevent SQL injection,ProgramDevelopers need to make great efforts to filter and check parameters. In this way, the upper layer is protected against injection.
In fact, the underlying anti-injection method can be used to make up for the shortcomings of the upper layer. Here, we will introduce two free tools.
Mi
In the following example, the fnmatch function is used for character wildcard, such as matching *,? .
Source code:
************************ ********************* Filename: fnmatch. c* Purpose: describes how to use fnmatch for character matching.* Wrote by: zhoulifa (zhoulifa@163.com) Zhou Lifa (http://zhoulifa.bokee.com)Linux enthusiasts Linux knowledge disseminators sohowhose developers are best at C Language* Date Time: Shanghai Heavy snow
]";+ ---------- + ------- + --------- + ------ + ------------ +| Name | owner | species | sex | birth | death |+ ---------- + ------- + --------- + ------ + ------------ +| Claws | Gwen | cat | m | 1994-03-17 | NULL || Boane | Diane | dog | m || Whistler | Gwen | bird | NULL | 1997-12-09 | NULL |+ ---------- + ------- + --------- + ------ + ------------ +Since a regular expression appears anywhere in the value and its pattern matches, there is no need to place a
Wildcard description_ Match with any single character% Matches a string that contains one or more characters.[] Matches any single character in a specific range (for example, [a-f]) or a specific set (for example, [abcdef.[^] Matches any single character other than a specific range (for example, [^ a-f]) or a specific set (for example, [^ abcdef.
Example:
• Where firstname like '_ im' can find names ending with IM (for example, Jim and Tim) with all
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.