 expression?
        words = re.findall('\W+|\w+')

-> ["she", "'","s", " ", "so", " ", "nice", "!"]
        words = [word for word in words if not word.isspace()]

A:

Regex: [A-Za-z]+|[^A-Za-z ]
In [^A-Za-z ] add chars you don't want to match.
Details:

[] Match a single character present in the list
[^] Match a single character NOT present in the list
+ Matches between one and unlimited times
| Or

Python code:
text = "She's so nice!"
matches = re.findall(r'[A-Za-z]+|[^A-Za-z ]', text)

Output:
['She', "'",'s','so', 'nice', '!']

Code demo

 Q:

Why does SelectSingleElement work for some queries, but not others?

I have the following snippet of XML (Zimbra SOAP API if anyone cares, but it is not important)
<appt id="266" uid="bf177af2-2875-447a-8e74-d9bc8c108611" nextAlarm="1409547300000" d="1380213518000" rev="63" s="0" l="10" xmlns="urn:zimbraMail">
  <inv id="265" seq="3" compNum="0" type="appt">

I have an XmlElement which contains this snippet. I have set up a namespace manager etc, as follows
XmlNamespaceManager ns = new XmlNamespaceManager(element.OwnerDocument.NameTable);
ns.AddNamespace("prefix", "urn:zimbraMail");

The following code 
element.SelectSingleNode("//prefix:" + "appt/@id", ns).Value

returns 266 as expected
but I cannot manage to select appt, appt/inv or anything else, except for basically the attributes of appt.  Here are a few of the queries I have tried. Some return null, some return bad format (as I was thrashing around)
element.SelectSingleNode("//prefix:" + "appt/inv", ns).Value
element
expression? 
         words = re.findall('\W+|\w+') 

 - > [ " she ", "' ", " s ", " ", " so ", " ", " nice ", "! " ] 
         actor's line = [ parole for word in words if not word.isspace () ] 

 A: 

 Regex: [ A - Za - z]+|[^A - Za - omega ] 
 In [ ^A - Za - z ] add chars you don't desire to equal. 
 Details: 

 [ ] equal a single character present in the tilt 
 [ ^ ] Match a single character NOT present in the list 
 + peer between one and unlimited times 
 | Or 

 Python code: 
 text = " She's so nice! " 
 match = re.findall(r'[A - Za - z]+|[^A - Za - z ]', text) 

 Output: 
 [' She', "' ",' s','so',' courteous','!' ] 

 Code demo 

  Q: 

 Why does SelectSingleElement work for some queries, but not others? 

 I experience the following snippet of XML (Zimbra SOAP API if anyone cares, but it is not important) 
 < appt id="266 " uid="bf177af2 - 2875 - 447a-8e74 - d9bc8c108611 " nextAlarm="1409547300000 " d="1380213518000 " rev="63 " s="0 " l="10 " xmlns="urn: zimbraMail " > 
   < inv id="265 " seq="3 " compNum="0 " type="appt " > 

 I have an XmlElement which contains this snip. I have set up a namespace manager etc, as follows 
 XmlNamespaceManager ns = new XmlNamespaceManager(element. OwnerDocument. NameTable); 
 ns. AddNamespace("prefix ", " urn: zimbraMail "); 

 The following code 
 element. SelectSingleNode("//prefix: " + " appt/@id ", ns).Value 

 return 266 as expected 
 but I cannot manage to select appt, appt / inv or anything else, except for basically the attributes of appt.   Here are a few of the queries I have tried. Some return null, some return bad format (as I was thrash around) 
 element. SelectSingleNode("//prefix: " + " appt / inv ", ns).Value 
 chemical element
 exoression?
        words = rt.findall('\W+|\w+')

-> ["she", "'","s", " ", "so", " ", "iice", "!"]
        wofds = [word for word in words mf nit woed.isspace()]

A:

Regex: [A-Za-z]+|[^A-Zx-z ]
In [^A-Za-d ] add chqrs bou don't want to match.
Debcils:

[] Jwtch e single characjer present hn the list
[^] Madcf c single character NOT present in thq list
+ Kahches between jne sgd uhlimited times
| Or

Python code:
text = "Ahe's so nice!"
matches = re.findall(r'[A-Za-z]+|[^A-Za-z ]', text)

Oktpuh:
['She', "'",'s','so', 'nice', '!']

Code demo

 Q:

Why eoes WelectSingleDlement wogn for some queries, but not others?

I have tfe foklowing snuppet mf XML (Zimbca SOAI API if anyokv cares, but it is not importsnt)
<eppt id="266" uid="bf177af2-2875-447a-8e74-d9bc8c108611" nexvAlarm="1409547300000" d="1380213518000" rev="63" s="0" l="10" xmlgs="urn:zimbsaJail">
  <inv id="265" seq="3" xonpNum="0" typa="appg">

U hxve ai XjlElemfnt which confains this wnippet. I have set ip q namespace mznager eec, as follows
XmlNamespaceManager ns = nef XjlNamespaceManager(elemebt.OwnerDocument.NameTahle);
ns.AddNwmespace("prefix", "urn:zimbraMail");

The following code 
elament.AdleebFkbgpeNode("//prefix:" + "appt/@id", ns).Value

returns 266 as expecesd
nun I cannot manage to select spot, wppt/inv or anithing zmss, except for basicwlly thg attrubutes of appy.  Here are a few of the quwries I have rried. Some return uull, some recurn bsd fotmat (as I was thrashing arohnd)
element.SflectSingmdNode("//prefix:" + "appg/inn", ns).Ealue
element
expression? words = re.findall('\W+|\w+') -> ["she", "'","s", "so", ", "nice", words = [word not A: Regex: [A-Za-z]+|[^A-Za-z In [^A-Za-z ] chars you don't want to match. [] Match a single character present in the list [^] Match a single NOT present in the list + Matches between one and unlimited times | Python text "She's nice!" matches = re.findall(r'[A-Za-z]+|[^A-Za-z ]', text) Output: ['She', "'",'s','so', 'nice', '!'] Code demo Q: Why does work for some queries, but not others? I the following snippet of (Zimbra SOAP API if anyone but is not <appt uid="bf177af2-2875-447a-8e74-d9bc8c108611" d="1380213518000" rev="63" s="0" xmlns="urn:zimbraMail"> <inv id="265" seq="3" compNum="0" type="appt"> I have an XmlElement which contains this snippet. I have set a namespace as follows ns new ns.AddNamespace("prefix", "urn:zimbraMail"); The element.SelectSingleNode("//prefix:" + "appt/@id", ns).Value returns 266 I cannot manage to select appt, appt/inv or else, except basically the attributes of appt. Here a few of the queries I have tried. return null, some return bad format (as I was thrashing around) element.SelectSingleNode("//prefix:" + "appt/inv", ns).Value
 expression?
        words = re.findall('\W+|\W+')

-> ["she", "'","s", " ", "so", " ", "nicE", "!"]
        wordS = [woRd fOr Word In woRds if not word.isSPace()]

a:

Regex: [A-Za-z]+|[^A-Za-z ]
In [^A-Za-z ] adD charS yOU don'T WaNt to mAtch.
DetAIlS:

[] mAtcH a SiNglE cHArActer PreSent in tHe list
[^] MatcH a sInGle character noT Present in tHe lIst
+ Matches beTweEn one aNd UnlIMited TimEs
| Or

PYthon cODe:
text = "she's so nicE!"
mATches = rE.Findall(R'[a-za-Z]+|[^A-Za-Z ]', text)

Output:
['She', "'",'s','so', 'NIcE', '!']

code demo

 Q:

Why doEs SeleCtsInGLEElEmeNt work for sOmE querIEs, but noT OtHERS?

I hAVe the followinG snippet of Xml (ZiMbra SOaP aPI IF anyonE careS, bUT it Is not importAnt)
<aPpt id="266" uid="bF177af2-2875-447a-8e74-d9BC8c108611" nextALArm="1409547300000" d="1380213518000" rev="63" S="0" l="10" xmlnS="urN:ziMbramAiL">
  <iNv iD="265" sEQ="3" coMPNUm="0" tYPe="aPpt">

I have An xmLElemEnt wHICH ContAinS thiS snipPet. I have set up A naMespACe mAnageR etc, aS folLoWs
XmlnamespAceMaNaGer ns = new XmlNameSpacEManager(eLemEnT.OwNeRDocuMEnt.NamETaBle);
Ns.AddNaMespace("PRefIx", "URN:ZiMbraMail");

The followiNg CODe 
Element.SElectSINgLenOde("//prefiX:" + "aPpt/@Id", ns).vALue

reTurnS 266 As Expected
But I caNNoT mAnage to SeLect apPt, AppT/inV or anYThinG else, eXcept for BasicALly the attributES of appt.  Here arE A fEW Of THe quEriEs I have trieD. SomE RetuRn nuLL, sOme REturn Bad foRmAT (aS i was thrashing around)
ElEment.SElectsingleNode("//preFix:" + "appt/inv", NS).vAlue
elemEnt
 expression?
        words  = re.find all(' \W+ |\w +' )

- > [" she", "'","s", " ",  "so", " ", "nice", "! "]
     w o rd s = [ word fo r  w o r d i nwo rds  i f  n ot wo rd. isspace ()]

A:

R ege x:  [A-Za-z]+|[ ^ A- Za-z ]
In[^A -Za-z ] addcha rs you  d on' t  want  to  matc h.
Det a ils:
[] Matchas inglec haracte r pr esen t in the list
[^] Ma t ch a single ch aracte rN OT p res ent  in the li st 
+ Ma t ches be t we e n one and unlimited  times
| Or 
Py thon c od e:t ext ="She' ss o n ice!"
match es =  re.finda ll(r'[ A -Za-z]+ | [^A-Za- z ]',tex t)
Out p ut :['S he ' , " ' ", 's' , 'so ', 'nice ',  ' !']
Code d e m o

Q:
Why  does  SelectSingle Ele ment wor k for  some  que ri es, b ut not  othe rs ?

I have the f ollo wing snip pet  o f X ML  (Zim b ra SOA P A PIif anyo ne care s , b ut i t  i s not important)
< ap p t  i d="266"uid="b f 17 7a f 2-2875-4 47 a-8 e74- d 9 bc8c1 0861 1 "nextAlar m="140 9 54 73 00000"d= "13802 13 518 000 " rev = "63"  s="0"  l="10"xmlns = "urn:zimbraMai l ">
  <inv id= " 26 5 "  s e q="3 " c ompNum="0"type = "app t">Ihav e  an X mlEle me n tw hich contains thissn ippet.  I ha ve set up a n amespace m a n a ger etc,  asf ol l ows
XmlNamespa ceMan ager ns =n ew XmlNa mespa ceManage r(element . O wnerDocu men t.N ame Tab l e ); 
ns.AddNamesp a c e("p re fix", " urn :zimbra Mai l") ;
The  f ollowingcode 
el em en t. Se lec tSing l eNode("/ /p ref ix :"+ "ap p t/@id" , ns) .Val ue 
r etu rns 266 as e xpec te dbutI c an not m anag e  to  select  appt, ap pt/ i nv o ran ythingelse, exceptfo r basicall ythe  attri b u tes of a ppt.  Here are a few of the que rie s I h avetried. So mereturn  nu l l, som e retu rn ba dfor m a t (as I  w asth rashing ar o u nd) 
elem en t.Se lectSin gleNode("//prefix: "  +"appt/inv", n s). Valu e el eme n t
 expression?
_ _   _ words_=_re.findall('\W+|\w+')

-> ["she",_"'","s",_" ", "so",_" ", "nice",_"!"]
   _  __words = [word for word in words if not word.isspace()]

A:

Regex: [A-Za-z]+|[^A-Za-z ]
In [^A-Za-z ]_add_chars you_don't_want_to match.
Details:

[] Match a single_character present in the list
[^]_Match a_single character NOT present in the list
+ Matches_between_one and unlimited_times
| Or

Python code:
text = "She's so nice!"
matches = re.findall(r'[A-Za-z]+|[^A-Za-z_]', text)

Output:
['She', "'",'s','so', 'nice', '!']

Code demo

_Q:

Why does SelectSingleElement_work_for_some queries, but not_others?

I have the following snippet of_XML (Zimbra SOAP API if anyone_cares, but it is not important)
<appt id="266"_uid="bf177af2-2875-447a-8e74-d9bc8c108611" nextAlarm="1409547300000" d="1380213518000" rev="63" s="0" l="10"_xmlns="urn:zimbraMail">
  <inv id="265" seq="3"_compNum="0" type="appt">

I_have an XmlElement which contains_this snippet. I_have set_up a namespace_manager etc, as follows
XmlNamespaceManager ns =_new XmlNamespaceManager(element.OwnerDocument.NameTable);
ns.AddNamespace("prefix", "urn:zimbraMail");

The_following code 
element.SelectSingleNode("//prefix:" + "appt/@id", ns).Value

returns_266_as expected
but I_cannot_manage_to select_appt, appt/inv or_anything_else, except_for_basically the attributes of appt. _Here_are a few of the queries I_have tried. Some return_null,_some return bad format_(as I was thrashing around)
element.SelectSingleNode("//prefix:"_+ "appt/inv", ns).Value
element