Title Description
Please implement a function to match the include '. ' And the regular expression of ' * '. The characters in the pattern '. ' Represents any character, and ' * ' means that the character preceding it can appear any time (0 times). In the subject, the match refers to all characters of the string that match the entire pattern. For example, the string "AAA" matches the pattern "a.a" and "ab*ac*a", but does not match "aa.a" and "Ab*a"
Code:
<span style= "color: #000099;" >public class Solution {public Boolean match (char[] str, char[] pattern) { if (str.length==0&& pattern.length==0) return true; if (str==null| | Pattern==null) return false; else{ stringbuffer sb=new stringbuffer (); StringBuffer sf=new StringBuffer (); for (int k=0;k<str.length;k++) sb.append (Str[k]); String s1=sb.tostring (); for (int k=0;k<pattern.length;k++) sf.append (Pattern[k]); String s2=sf.tostring (); return s1.matches (s2);}} </span>
The regular expression match of the sword Point offer (58)