pattern='''
^ #beginning of string
M{0,3} # thousands- 0 to 3 MS
(CM|CD|D?C{0,3}) # hundreds - 900 (CM), 400 (CD), 0-300 (0 to 3 Cs), or 500-800 (D, followed by 0 to 3 Cs)
(XC|XL|L?X{0,3}) # tens - 90 (XC), 40 (XL), 0-30 (0 to 3 Xs), or 50-80 (L, followed by 0 to 3 Xs)
(IX|IV|V?I{0,3}) # ones - 9 (IX), 4 (IV), 0-3 (0 to 3 Is), or 5-8 (V, followed by 0 to 3 Is)
$ #end of string
'''
根据diveintopython3网站和我的逻辑,re.search(模式,' M',re.VERBOSE)应该返回字符串匹配,但是当我进入call re时我没有返回。搜索。这是为什么?
答案 0 :(得分:0)
它适用于我:
[global::System.Data.Linq.Mapping.FunctionAttribute(Name="dbo.parseXMLForK12_EachStudent")]
public ISingleResult<parseXMLForK12_EachStudentResult> parseXMLForK12_EachStudent([global::System.Data.Linq.Mapping.ParameterAttribute(DbType="NVarChar(MAX)")] string strXML, [global::System.Data.Linq.Mapping.ParameterAttribute(DbType="Date")] System.Nullable<System.DateTime> datesaved, [global::System.Data.Linq.Mapping.ParameterAttribute(DbType="Int")] System.Nullable<int> filepassed, [global::System.Data.Linq.Mapping.ParameterAttribute(DbType="Int")] System.Nullable<int> whichproc)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), strXML, datesaved, filepassed, whichproc);
return ((ISingleResult<parseXMLForK12_EachStudentResult>)(result.ReturnValue));
}
public partial class parseXMLForK12_EachStudentResult
{
private System.Nullable<int> _Column1;
public parseXMLForK12_EachStudentResult()
{
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Name="", Storage="_Column1", DbType="Int")]
public System.Nullable<int> Column1
{
get
{
return this._Column1;
}
set
{
if ((this._Column1 != value))
{
this._Column1 = value;
}
}
}
}
也许你感到困惑,因为re.search返回一个“匹配对象”,而不是直接返回匹配的字符串。