none
Regex in WhlFiltAppWrap_HTTPS

    Question

  • I want to replace some HTML code from SharePoint 2010 pages. Two sample lines I want to replace:

    <ie:menuitem id="zz25_ID_Logout" type="option" menuGroupId="200" description="Logout of this site." text="Sign Out" onMenuClick="STSNavigate2(event,'/_layouts/SignOut.aspx');"/>
    <ie:menuitem id="zz25_ID_Logout" type="option" menuGroupId="200" description="Logout of this site." text="Sign Out" onMenuClick="STSNavigate2(event,'/parties/c1/000121524/_layouts/SignOut.aspx');"/>

    They should become

    <ie:menuitem id="zz25_ID_Logout" type="option" menuGroupId="200" description="Logout of this site." text="Sign Out" onMenuClick="javascript:endSession()"/>

    I got it working if I do it without regex, but as you can guess the /partices/c1/000121524 can vary.

    <APP_WRAP ver="3.0" id="WhlFiltAppWrap_HTTPS.xml">
    <MANIPULATION>
    	<MANIPULATION_PER_APPLICATION>
    		<APPLICATION_TYPE>SharePoint14AAM</APPLICATION_TYPE>
    		<DATA_CHANGE>
    		<!-- for sharepoint 2010 conditional appwrap hide log off   -->
    		<URL case_sensitive="false">.*\.aspx.*</URL>				
    				<SAR conditional_variable="DontShowLogoff" conditional_var_value="False"> 
    					<SEARCH encoding="" mode="regex">onMenuClick="STSNavigate2\(event,'[a-zA-Z0-9/]*/_layouts/SignOut\.aspx'\);"</SEARCH>
    					<REPLACE encoding="">onMenuClick="javascript:endSession()</REPLACE>
    				</SAR>
    				<SAR conditional_variable="DontShowLogoff" conditional_var_value="False"> 
    					<SEARCH encoding="">served</SEARCH>
    					<REPLACE encoding="">dddddd</REPLACE>
    				</SAR>
    		</DATA_CHANGE>
    		<!-- Sharepoint 14 supplemental END -->
    	</MANIPULATION_PER_APPLICATION>
    </MANIPULATION>
    </APP_WRAP>

    I tried using base64 encoding, but that didn't made a difference. So far faster testing I'm not using base64 encoding. The "served" "ddddd" is just a quick and easy SAR which helps me see my custom file is actually working.

    I use http://regexpal.com/ to test my regex and they seem to match. Even without escaping (). I'm a bit stuck... Anyone has some clues?


    http://setspn.blogspot.com

    Friday, April 11, 2014 3:12 PM