<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Regular Expressions in Javascript API in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/regular-expressions-in-javascript-api/m-p/118299#M83438</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes i think you are right. Rhino JavaScript generally is very good at converting Java String to JS String automatically - but for some operations (like getting a String out of a Map rather than directly from a getter method) it does not perform the conversion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will add a note about it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Oct 2007 11:23:08 GMT</pubDate>
    <dc:creator>kevinr</dc:creator>
    <dc:date>2007-10-26T11:23:08Z</dc:date>
    <item>
      <title>Regular Expressions in Javascript API</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/regular-expressions-in-javascript-api/m-p/118296#M83435</link>
      <description>Hi. Has anyone successfully used a regular expression in the Javascript API? Every time I try i seem to get an error.The simplest attempt was a string replace method. e.g.strBlah.replace(/expression/g, 'replace with me');‍For some reason that never works but if I replace the expression with a string</description>
      <pubDate>Tue, 09 Oct 2007 10:49:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/regular-expressions-in-javascript-api/m-p/118296#M83435</guid>
      <dc:creator>randomman</dc:creator>
      <dc:date>2007-10-09T10:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions in Javascript API</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/regular-expressions-in-javascript-api/m-p/118297#M83436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&amp;gt;I can use the example above in a web script but not in a standard script&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That's very strange. Both the webscript and standard javascript action implementation both use the same Rhino based ScriptService underneath! If Rhino supports it then so should we. If you use the RegExp object directly does it work? &lt;/SPAN&gt;&lt;A href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:RegExp" rel="nofollow noopener noreferrer"&gt;http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:RegExp&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;Also, more script weirdness: I found that the string length property didn't seem to work properly when used on a node's content. I would get odd results. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you sure you are retrieving the length of the content itself or some property object? Remember the properties of type d:content are themselves objects which have further properties such as mimetype and size:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://wiki.alfresco.com/wiki/JavaScript_API#ScriptContent_API" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/JavaScript_API#ScriptContent_API&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;So you should be using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;node.properties.content.size&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2007 12:31:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/regular-expressions-in-javascript-api/m-p/118297#M83436</guid>
      <dc:creator>kevinr</dc:creator>
      <dc:date>2007-10-17T12:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions in Javascript API</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/regular-expressions-in-javascript-api/m-p/118298#M83437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your response. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The root cause of my problem was indeed related to the content property of a ScriptNode. Although described as 'A read/write value that represents the content as a string', it doesn't actually behave like a js String. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to use String methods (such as a regex-based replace) on document content, I created a specific String object from the content. e.g.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;var strContent = String(document.content);&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it worth putting a note to that effect on the Wiki?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2007 13:15:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/regular-expressions-in-javascript-api/m-p/118298#M83437</guid>
      <dc:creator>randomman</dc:creator>
      <dc:date>2007-10-18T13:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions in Javascript API</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/regular-expressions-in-javascript-api/m-p/118299#M83438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes i think you are right. Rhino JavaScript generally is very good at converting Java String to JS String automatically - but for some operations (like getting a String out of a Map rather than directly from a getter method) it does not perform the conversion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will add a note about it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Oct 2007 11:23:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/regular-expressions-in-javascript-api/m-p/118299#M83438</guid>
      <dc:creator>kevinr</dc:creator>
      <dc:date>2007-10-26T11:23:08Z</dc:date>
    </item>
  </channel>
</rss>

