SGMLXML.net A place for SGML and XML application developers.

March 11, 2005

Summary of regular expressions

Filed under: REGEXP — cangione @ 2:32 pm




Operator

Description

.

Any single character. Example: h.t matches hat, hit, hot and hut.

[ ]

Any one of the characters in the brackets, or any of a range of characters separated by a hyphen (-), or a character class operator (see below). Examples: h[aeiou][a-z] matches hat, hip, hit, hop, and hut; [A-Za-z] matches any single letter; x[0-9] matches x0, x1, …, x9.

[^]

Any characters except for those after the caret "^". Example: h[^u]t matches hat, hit, and hot, but not hut.

^

The start of a line (column 1).

$

The end of a line (not the line break characters). Use this for restricting matches to characters at the end of a line. Example: end$ only matches "end" when it’s the last word on a line, and ^end only matches "end" when it’s the first word on a line.

\<

The start of a word.

\>

The end of a word.

\t

The tab character.

\xdd

"dd" is the two-digit hexadecimal code for any character.

\( \)

Groups a tagged expression to use in replacement expressions. An RE can have up to 9 tagged expressions, numbered according to their order in the RE. The corresponding replacement expression is \x, for x in the range 1-9. Example: If \([a-z]+\) \([a-z]+\) matches "way wrong", \2 \1 would replace it with "wrong way".

*

Matches zero or more of the preceding characters or expressions. Example: ho*p matches hp, hop and hoop.

?

Matches zero or one of the preceding characters or expressions. Example: ho?p matches hp, and hop, but not hoop.

+

Matches one or more of the preceding characters or expressions. Example: ho+p matches hop, and hoop, but not hp.

\{count\}

Matches the specified number of the preceding characters or expressions. Example: ho\{2\}p matches hoop, but not hop.

\{min,\}

Matches at least the specified number of the preceding characters or expressions. Example: ho\{1,\}p matches hop and hoop, but not hp.

\{min,max\}

Matches between min and max of the preceding characters or expressions. Example: ho\{1,2\}p matches hop and hoop, but not hp or hooop.

\|

Matches either the expression to its left or its right. Example: hop\|hoop matches hop, or hoop.

 

Find all entities within a document

Filed under: REGEXP — cangione @ 2:32 pm




&[^;]*;

SED Replacement Command

Filed under: REGEXP — cangione @ 2:32 pm




sed -i 's/[reg expr that is]/[replacement]/g' [file(s)]

Show the command behind the menu item

Filed under: ACL — cangione @ 2:27 pm




Example:
eval menu_cmd(".Format.Modify Element in Context")

See what the Java class path is in Epics embedded JVM

Filed under: ACL — cangione @ 2:27 pm




Example:
 eval  java_static('java.lang.System', 'getProperty',     'java.class.path')

Searching a List for a Value in ACL

Filed under: ACL — cangione @ 2:27 pm




This provides a way of checking a value against a list.
Example:
$DOCTYPES["FOO//BAR//EN"] = 1
$DOCTYPES["FOO//BAR2//EN"] = 1
function check_doctype() {
$name=check_public_id();
if ($name in DOCTYPES) {
#DO SOMETHING
}
}

Return Unqiue Element Content

Filed under: ACL — cangione @ 2:27 pm




Notes:

  • Quick helper function when going after unique elements known to be present in a document.
  • No Error Handeling
  • If there are two of the same element only returns the first

Example:

function return_unique_element_content(elementname){

local status = oid_find_children(oid_null(), $arr, $elementname)

if ($status == 1) {

local elemoid = $arr[1]

local elemcontent = oid_content($arr[1]);

return $elemcontent

}

}

How to run a batch file from ACL

Filed under: ACL — cangione @ 2:27 pm




You can use the ACL "sh" command, which shells out to the operating system.

For example:

sh start mybatchfile.cmd;

Change the color of change tracking in Epic Using ACL

Filed under: ACL — cangione @ 2:27 pm




modify_tag -global aticldel

Documentum Plugin Posted

Filed under: Eclipse — cangione @ 2:12 pm




http://www.eclipse-plugins.info/eclipse/plugin_details.jsp?id=920
 
This is a great plugin for documentum:
 
  1. Extract the zip to eclipse\plugins directory
  2. Assumes you have Desktop Client installed
  3. Copy dfc.jar and dfcbase.jar to the org.cah.eclipse.plugins.dctm.dql directory
  4. Your Shortcut to launch eclipse should look somethime like this "C:\Eclipse\eclipse.exe -vmargs Ddfc.properties.file=C:\documentum\config\dfc.properties"

Maven Project

Filed under: ANT — cangione @ 2:04 pm




Maven is a Java project management and project comprehension tool. Maven is based on the concept of a project object model (POM) in that all the artifacts produced by Maven are a result of consulting a well defined model for your project. Builds, documentation, source metrics, source cross-references and a countless number of reports are all controlled by your POM.

 http://maven.apache.org/

 

Good to know about Flow

Filed under: XSL — @ 2:01 pm






 You can't have static content (ie stuff for headers and footers in the fo:flow element)! Put it before.

« Newer PostsOlder Posts »

Powered by WordPress