Safari May Not Interpret Regular Expression in Compliance with W3C Standard

We are troubleshooting why some websites are no longer working when rendered with the Safari 2.0.4 browser. The failure begins when client entered data is validated using regular expressions.
We have localized the issue to Safari's not interpretting regular expressions consistently.
For example:
Does the regex \u00e9 match the literal character é? (Validates the regular expression engine understands Unicode escape sequences for extended characters.)? - NO, but it does on IE and FireFox
Does the regex \u0041 match the literal character A? (Validates the regular expression engine understands Unicode escape sequences for ASCII characters.)? - NO, but it does on IE and FireFox
Does the regex é match the literal character é? (Validates the regular expression engine understands literal characters outside the ASCII range – this is against ECMAScript spec.)? - Sometimes, but always on IE and FireFox
Write a Unicode escape sequence to the screen on the client side. (Validates the string parsing and display in the JS engine works.) - Works on all 3
Is escape sequence \u00e9 equivalent to literal character é? (Validates the string functionality in the JS engine works with extended characters.)? Yes on all 3.
Is escape sequence \u0041 equivalent to literal character A? (Validates the string functionality in the JS engine works with ASCII characters.)? Yes on all 3
Does the regex A match the literal character A? (Validates the regular expression engine understands literal characters in the ASCII range – this is ECMAScript spec.)? Yes on all 3
Please help. It's hard for me to believe that the regular expression / javascript interpreter(s) for Safari aren't working as they have in the past - but all roads are pointed that way....
Thank you for your review.
  Mac OS X (10.4.7)  

We are troubleshooting why some websites are no longer working when rendered with the Safari 2.0.4 browser. The failure begins when client entered data is validated using regular expressions.
We have localized the issue to Safari's not interpretting regular expressions consistently.
For example:
Does the regex \u00e9 match the literal character é? (Validates the regular expression engine understands Unicode escape sequences for extended characters.)? - NO, but it does on IE and FireFox
Does the regex \u0041 match the literal character A? (Validates the regular expression engine understands Unicode escape sequences for ASCII characters.)? - NO, but it does on IE and FireFox
Does the regex é match the literal character é? (Validates the regular expression engine understands literal characters outside the ASCII range – this is against ECMAScript spec.)? - Sometimes, but always on IE and FireFox
Write a Unicode escape sequence to the screen on the client side. (Validates the string parsing and display in the JS engine works.) - Works on all 3
Is escape sequence \u00e9 equivalent to literal character é? (Validates the string functionality in the JS engine works with extended characters.)? Yes on all 3.
Is escape sequence \u0041 equivalent to literal character A? (Validates the string functionality in the JS engine works with ASCII characters.)? Yes on all 3
Does the regex A match the literal character A? (Validates the regular expression engine understands literal characters in the ASCII range – this is ECMAScript spec.)? Yes on all 3
Please help. It's hard for me to believe that the regular expression / javascript interpreter(s) for Safari aren't working as they have in the past - but all roads are pointed that way....
Thank you for your review.
  Mac OS X (10.4.7)  

Similar Messages

  • Regular Expression wierdness - problem with $ character

    If I use the following KM code in Beanshell Technology - it works correctly and replaces "C$_0MYREMOTETABLE RMTALIAS, MYLOCALTABLE LOCALIAS, " with "C$_0MYREMOTETABLE_000111 RMTALIAS, MYLOCALTABLE LOCALIAS, "
    But when I try to use the same exact code in 'Undefined' technology - it does not match anything in the source string - and does not replace anything.
    If I change the regular expression to not use the $ it still does not work.
    But if I change the source string to remove the $ - then the regular expression works.
    If I use the same code in Beanshell technology - it works fine - but then I can't use the value in a later 'Undefined' technology step.
    Does anyone know if the java technology does something special with $ characters when ODI parses the KM code?
    Does anyone know if there is a way to use the value from a Beanshell variable in a 'Undefined' technology step?
    String newSourceTableList = "";
    String sessionNum ="<%=odiRef.getSession("SESS_NO") %>";
    String sourceTableList = "<%=odiRef.getSrcTablesList("", "[WORK_SCHEMA].[TABLE_NAME] [POP_TAB_ALIAS]" , ",", ",") %>";
    String matchExpr = "(C\\$_\\S*)"; (should end with two backslashes followed by 'S*' - this editor mangles it)
    String replaceExpr = "$0_"+sessionNum+ " ";
    newSourceTableList = sourceTableList.replaceAll(matchExpr,replaceExpr);
    ---------------------------------------------------

    Phases of substitution in ODI:
    The way ODI works allows for three separate phases of substitution, and you can use them all. The three phases are:
    - First Phase: <% %> You will see these appear in the knowledge moduiles etc and these are substituted on generation. (when you generate a scenario, or tell ODI to execute an interface directly) this phase is used to generate the column names, table names etc which are known from the metadata at that phase.
    - Second Phase: <? ?> This phase is substituted when the scenario is instatntiuated as an excution - session generation. At this point, ODI has the additional information which allows it to generate the schema names, as it has resolved the Logical/Physical Schemas through the use of the Context (which is provided for the execution to take place. All the substitutions at this point are written to the execution log.
    - Third Phase <@ @> This phase is substituted when the execution code is read from the session log for execution. You will note that anything substituted in this phase is NEVER written to the execution log. (see PASSWORDS as a prime example, you don't want those written to the logs, with the security risks associated with that!)
    Anything in <@ @> is always interpreted for substitution by the java beanshell, it does not have to be a Java Beanshell step, it can be any kind of step, it will be interpreted at that run-time point.

  • Regular Expression Character Sets with Pattern and Matcher

    Hi,
    I am a little bit confused about a regular expressions I am writing, it works in other languages but not in Java.
    The regular expressions is to match LaTeX commands from a file, and is as follows:
    \\begin{command}([.|\n\r\s]*)\\end{command}
    This does not work in Java but does in PHP, C, etc...
    The part that is strange is the . character. If placed as .* it works but if placed as [.]* it doesnt. Does this mean that . cannot be placed in a character range in Java?
    Any help very much appreciated.
    Kind Regards
    Paul Bain

    In PHP it seems that the "." still works as a all character operator inside character classes.
    The regular expression posted did not work, but it does if I do:
    \\begin{command}((.|[\n\r\s])*)?\\end{command}
    Basically what I'm trying to match is a block of LaTeX, so the \\begin{command} and \\end{command} in LaTeX, not regex, although the \\ is a single one in LaTeX. I basically want to match any block which starts with one of those and ends in the end command. so really the regular expression that counts is the bit in the middle, ((.|[\n\r\s])*)?
    Am I right it saying that the "?" will prevent the engine matching the first and last \\bein and \\end in the following example:
    \\begin{command}
    some stuff
    \\end{command}
    \\begin{command}
    some stuff
    \\end{command}

  • Regular expressions: find files with exactly 'n' digits in a row

    Hi there,
    I want to filter files that contain only a fixed number of digits, but not more (at least not in after the digits).
    For example, I have
    01.mp3
    02.mp3
    test10.txt
    test000110101010.txt
    04.flac
    and for n=2 I want to get all files except 'test000110101010.txt'.
    The following is not working, and I'm a total newb regarding regular expressions
    ls -l | grep '^-' | awk '{print $9}' | grep '([0-9]\{2\})[^0-9]\{2\}'
    Thanks for help.
    Regards,
    drm

    Thanks!
    I wrote a python script to scan e.g. a music folder for missing files and needed to extract the file numbers from the files to get the "highest" number.
    You can get it from here: http://pastebin.com/Sg9yDHiw (Python3, expires in 1 month)
    Regards,
    drm
    Edit: found a bug
    Last edited by drm00 (2011-02-04 13:57:43)

  • Regular expression on words with % wildcard

    Hi,
    I've got some processing working using regular expression where I need to process words e.g.
    regexp_replace('word1 word2','(\w+)','myprefix{\1}') - results in - 'myprefixword1 myprefixword2'
    However, if I'm presented with this; '%word0 word1% wo%d2 word3', then I need to treat % as special case and leave the word as is, so result here would be; - '%word0 word1% wo%d2 myprefixword3', is this achievable using regexp ?

    And for those who don't know, I guess we should explain why we're having to expand single spaces to double spaces...
    (I'll use the "¬" character to represent spaces to make it clearer to see)
    If we have a string such as
    word1¬word2¬word3and we want to identify the words in the string (without using any special regexp word identifier) then we are going to use the spaces to identify the start and end of words. To make life easy, we manually put a space at the start and end of the string so we can say that each word in the string will have a space before and after it regardless of where it is in the string...
    ¬word1¬word2¬word3¬However, when we specify what we want to search for we are going to say we want a space, followed by a number of characters (not spaces), followed by a space...
    ¬[^¬]*¬So, ideally, you'd expect it to look through the string and say
    ¬word1¬word2¬word3¬
    \_____/... found word1
    ¬word1¬word2¬word3¬
          \_____/... found word2
    ¬word1¬word2¬word3¬
                \_____/... found word3
    Unfortunately, there is a problem. Once the first word has been found the pointer for searching the rest of the string is located on the next character after the match i.e.
    ¬word1¬word2¬word3¬
           ^So it won't be able to pick out word2 and will only get to word3. Let's see it in action...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select ' word1 word2 word3 ' as txt from dual)
      2  --
      3  select regexp_replace(txt, ' [^ ]* ', 'xxxxx') as txt
      4* from t
    SQL> /
    TXT
    xxxxxword2xxxxx
    SQL>In order to deal with this, if we replace the single spaces with double spaces (not required at the start and end) our string looks like...
    ¬word1¬¬word2¬¬word3¬So as it searches it finds word1 as a match and then the pointer in the string is located...
    ¬word1¬¬word2¬¬word3¬
           ^... so the next match for the pattern of space-characters-space is word2 and then the pointer is located...
    ¬word1¬¬word2¬¬word3¬
                  ^... ready to find word 3. Example...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select ' word1  word2  word3 ' as txt from dual)
      2  --
      3  select regexp_replace(txt, ' [^ ]* ', 'xxxxx') as txt
      4* from t
    SQL> /
    TXT
    xxxxxxxxxxxxxxx
    SQL>Hopefully that's a little clearer. You just have to remember the "pointer" principle and the fact that once a match is found it is located on the character after the match.
    ;)

  • Safari Does Not Allow Access to Web Sites With Wildcard X.509 Certificates

    I'm really getting irritated with the Safari browser in OSX Mavericks.  One of the more irritating features involves the inability to access web sites that use improperly constructed wildcard X509 certificates.  By improperly constructed, I mean that the X.509 certificate does not contain the host name of the system being accessed in the Subject Alternate Name list.
    Earlier versions of Safari would, at least, allow me to examine the X.509 certificate and determine whether I wanted to proceed with the connection.  The current version of Safari doesn't provide that option.  It simply displays a screen stating that it can't establish a secure connection to the web site.  If you actually have a need to access the web site, you need to use a web browser like Firefox.
    What's really irritating about this is that Safari had improved to the point where it was reliable enough to be used as the default browser.
    Is there a Safari.plist setting that will allow me to change the behavior of Safari when it encounters an improperly constructed X.509 certificate and provide me the opportunity to examine the certificate to decide whether to proceed or not?

    Hi
    Have a look in your Networks panel in System Preferences. Click on the Advanced button, then Proxies. There may be an errant proxy present blocking the site load.

  • Safari is not working and siri only works with the phone not internet related questions.

    I have an Iphone 5 and for about 8 months it worked find, then somewhere along the line I think about the time I upgraded to the latest OS, Safari stopped working.  That is when I hit a link from email or open safari I get the browser window but nothing works, like its been blocked.  Siri of course only works with internal serches, through contacts and such.  My other browsers (crome, oprea and mercury) work fine.  I have been through all the internal settigns I can find, but nothing has worked.  Have cleared history cookes with no suceess.  Any ideas?

    Hello Mike,
    Thank you for providing so much detail about the issue you are experiencing with Safari after upgrading to iOS 7.
    The first thing I recommend is quitting and relaunching the applications on your iPhone:
    Double-click the Home button.
    Swipe left or right until you have located the app you wish to close.
    Swipe the app up to close it.
    You can find the full article here:
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    If you are still seeing the same issue after quitting and relaunching the apps that are open, I recommend restarting your phone and then resetting if it's still not working:
    Restarting your device
    Press and hold the Sleep/Wake button for a few seconds until the red "slide to power off" slider appears, and then slide the slider.
    Press and hold the Sleep/Wake button until the Apple logo appears.
    Note: Reset your device only if you are unable to restart it.
    Resetting your device
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
    You can find the full article here:
    iPhone, iPad, iPod touch: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/ht1430
    If the issue persists, the last thing I recommend is backing up and restoring your iPhone:
    iOS: How to back up and restore your content
    http://support.apple.com/kb/HT1766
    iTunes: Restoring iOS software
    http://support.apple.com/kb/HT1414
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Not able to install rtcxds database with Lync Standard Edition

    Hello everybody,
    I'm trying to install Lync 2013 Standard in an lab environment. After publishing my topology i try to
    install the database from the topology builder and everything works fine, but the rtcxds database times out.
    It says that the database does not exist and will be created but it fails then with a timeout. The other
    databases are created successfully. A 4gb file is in the expected folder, which gets deleted when the timeout appears.
    I got 4 services on my server that won't start (SQL Server-Agent RTC & SQL Server-Agent LYNCLOCAL & SQL Server-Agent RTCLOCAL & Lync Server XMPP-Übersetzungsgateway)
    Log-File:
    ****DbSetupInstance für 'Microsoft.Rtc.Common.Data.BlobStore' wird erstellt****
    "DbSetupBase" wird initialisiert.
    Analyseparameter...
    Gefundener Parameter: SqlServer Wert lync01.lynctest.local\rtc.
    Gefundener Parameter: SqlFilePath Wert C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup.
    Gefundener Parameter: Publisheracct Wert LYNCTEST\RTCHSUniversalServices;RTC Server Local Group;RTC Local Administrators;LYNCTEST\RTCUniversalServerAdmins.
    Gefundener Parameter: Replicatoracct Wert LYNCTEST\RTCHSUniversalServices;RTC Server Local Group.
    Gefundener Parameter: Consumeracct Wert LYNCTEST\RTCHSUniversalServices;RTC Server Local Group;RTC Local Read-only Administrators;LYNCTEST\RTCUniversalReadOnlyAdmins.
    Gefundener Parameter: DbPath Wert e:\csdata\BackendStore\rtc\DbPath.
    Gefundener Parameter: LogPath Wert f:\cslog\BackendStore\rtc\LogPath.
    Gefundener Parameter: Role Wert master.
    Versuch, eine Verbindung mit SQL Server "lync01.lynctest.local\rtc" herzustellen. mit Windows-Authentifizierung...
    SQL-Version: Hauptversion: 11, Unterversion: 0, Build 5058.
    Die SQL-Version ist akzeptabel.
    Parameter werden überprüft...
    DbName rtcxds überprüft.
    SqlFilePath C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup überprüft.
    DbFileBase rtcxds überprüft.
    DbPath e:\csdata\BackendStore\rtc\DbPath überprüft.
    Wirksamer Datenbankpfad: \\lync01.lynctest.local\e$\csdata\BackendStore\rtc\DbPath.
    LogPath f:\cslog\BackendStore\rtc\LogPath überprüft.
    Wirksamer Protokollpfad: \\lync01.lynctest.local\f$\cslog\BackendStore\rtc\LogPath.
    Der Status für Datenbank "rtcxds" wird überprüft.
    Der Status für Datenbank "rtcxds" wird überprüft.
    Der Status der Datenbank "rtcxds" ist getrennt.
    Die Datenbank "rtcxds" wird von Datenpfad "\\lync01.lynctest.local\e$\csdata\BackendStore\rtc\DbPath" und Protokollpfad "\\lync01.lynctest.local\f$\cslog\BackendStore\rtc\LogPath" angefügt.
    Fehler des Vorgangs, weil die Datei "\\lync01.lynctest.local\e$\csdata\BackendStore\rtc\DbPath\rtcxds.mdf" fehlt.
    Fehler beim Anfügen der Datenbank, da eine der Dateien nicht gefunden wurde. Die Datenbank wird erstellt.
    Der Status der Datenbank "rtcxds" ist "DbState_DoesNotExist".
    Die Datenbank "rtcxds" wird von Grund auf neu erstellt. Pfad der Datendatei = e:\csdata\BackendStore\rtc\DbPath, Pfad der Protokolldatei = f:\cslog\BackendStore\rtc\LogPath.
    Die Installationsdatenbank "rtcxds" wird bereinigt.
    Timeout abgelaufen. Das Zeitlimit wurde vor dem Beenden des Vorgangs überschritten oder der Server reagiert nicht.
    ****DbSetupInstance für 'Microsoft.Rtc.Common.Data.RtcSharedDatabase' wird erstellt****
    "DbSetupBase" wird initialisiert.
    Analyseparameter...
    Gefundener Parameter: SqlServer Wert lync01.lynctest.local\rtc.
    Gefundener Parameter: SqlFilePath Wert C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup.
    Gefundener Parameter: Serveracct Wert LYNCTEST\RTCHSUniversalServices;RTC Server Local Group.
    Gefundener Parameter: DbPath Wert e:\csdata\BackendStore\rtc\DbPath.
    Gefundener Parameter: LogPath Wert f:\cslog\BackendStore\rtc\LogPath.
    Versuch, eine Verbindung mit SQL Server "lync01.lynctest.local\rtc" herzustellen. mit Windows-Authentifizierung...
    SQL-Version: Hauptversion: 11, Unterversion: 0, Build 5058.
    Die SQL-Version ist akzeptabel.
    Parameter werden überprüft...
    DbName rtcshared überprüft.
    SqlFilePath C:\Program Files\Common Files\Microsoft Lync Server 2013\DbSetup überprüft.
    DbFileBase rtcshared überprüft.
    DbPath e:\csdata\BackendStore\rtc\DbPath überprüft.
    Wirksamer Datenbankpfad: \\lync01.lynctest.local\e$\csdata\BackendStore\rtc\DbPath.
    LogPath f:\cslog\BackendStore\rtc\LogPath überprüft.
    Wirksamer Protokollpfad: \\lync01.lynctest.local\f$\cslog\BackendStore\rtc\LogPath.
    Der Status für Datenbank "rtcshared" wird überprüft.
    Die Datenbankversion für Datenbank "rtcshared" wird gelesen.
    Datenbankversion für Datenbank "rtcshared" – Schemaversion 5, Version der gespeicherten Prozedur 0, Updateversion 1.
    Does anyone have an idea, what causes this timeout/error?
    Thanks in Advance!
    Kind regards,
    Fabio

    Datei "\\lync01.lynctest.local\e$\csdata\BackendStore\rtc\DbPath\rtcxds.mdf" fehlt.
     Fehler beim Anfügen der Datenbank, da eine der Dateien nicht gefunden wurde. Die Datenbank wird erstellt.
    It looks like it can't find that file.  Do you see it on your drive? 
    If you run Topology Builder, will it let you download the topology from the Central Management store and publish a tiny change at the moment? 
    Do you get the same error if you rerun step 2?
    To confirm, this is your first Lync server in the environment?
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question please click "Mark As Answer".
    SWC Unified Communications

  • Match Regular Expression does not match what Match Pattern does

    I have read through a lot of posts about how Match Pattern does not match what Match Regular Expression will due to not processing some characters.
    However, I found a problem with the other way. A simple Reg-Ex that works in Match Pattern but not Match Regular Expression.
    What I have here is just an example. I want to use Match Regular Expression so I can specify some sub-matches.
    The reg-ex is for: one or more non-numeric characters, a space, one or more numeric characters. At the start of the string.
    How can I get this working in Match Regular Expression? I am working in LabVIEW 2010f2 32 bit. Here is the code snippet and the results:
    Rob
    Solved!
    Go to Solution.

    Robert Cole wrote:
    I think I prefer the ~ for negation since ^ is also used for beginning of the string. But we work with what we have.
    Let me offer you a tip and perhaps defend the honor of the regex a little bit.  One of my favorite features of regexes is the ability to specify character classes (and their negation).  One of the reasons I have to think about the ~ versus ^ is that I rarely use ^ in a regex alternative. 
    Some examples:
    [0-9] = \d (digit)
    [^0-9] = \D (not a digit)
    The equivalent regex for your case is: \D+ \d+

  • [SOLVED]ZSH and regular expressions

    Hi
    I am getting into regular expressions and i have noticed that with my .zshrc file i have some problem. In bash this expression works:
    \^\[^#]
    but not also in zsh. I have also noted that regular expression works fine with other zshrc configurations found in archwiki (like grml) but i want to have my configuration. And i really can't find what command make a difference
    My .zshrc file is pulled from this site https://github.com/slashbeast/things/bl … s/DOTzshrc.
    # .zshrc
    # Author: Piotr Karbowski <[email protected]>
    # License: beerware.
    # Basic zsh config.
    umask 077
    ZDOTDIR=${ZDOTDIR:-${HOME}}
    ZSHDDIR="${HOME}/.config/zsh.d"
    HISTFILE="${ZDOTDIR}/.zsh_history"
    HISTSIZE='10000'
    SAVEHIST="${HISTSIZE}"
    export EDITOR="/usr/bin/vim"
    export TMP="$HOME/tmp"
    export TEMP="$TMP"
    export TMPDIR="$TMP"
    export TMPPREFIX="${TMPDIR}/zsh"
    if [ ! -d "${TMP}" ]; then mkdir "${TMP}"; fi
    if ! [[ "${PATH}" =~ "^${HOME}/bin" ]]; then
    export PATH="${HOME}/bin:${PATH}"
    fi
    # Not all servers have terminfo for rxvt-256color. :<
    if [ "${TERM}" = 'rxvt-256color' ] && ! [ -f '/usr/share/terminfo/r/rxvt-256color' ] && ! [ -f '/lib/terminfo/r/rxvt-256color' ] && ! [ -f "${HOME}/.terminfo/r/rxvt-256color" ]; then
    export TERM='rxvt-unicode'
    fi
    # Colors.
    red='\e[0;31m'
    RED='\e[1;31m'
    green='\e[0;32m'
    GREEN='\e[1;32m'
    yellow='\e[0;33m'
    YELLOW='\e[1;33m'
    blue='\e[0;34m'
    BLUE='\e[1;34m'
    purple='\e[0;35m'
    PURPLE='\e[1;35m'
    cyan='\e[0;36m'
    CYAN='\e[1;36m'
    NC='\e[0m'
    # Functions
    if [ -f '/etc/profile.d/prll.sh' ]; then
    . "/etc/profile.d/prll.sh"
    fi
    run_under_tmux() {
    # Run $1 under session or attach if such session already exist.
    # $2 is optional path, if no specified, will use $1 from $PATH.
    # If you need to pass extra variables, use $2 for it as in example below..
    # Example usage:
    # torrent() { run_under_tmux 'rtorrent' '/usr/local/rtorrent-git/bin/rtorrent'; }
    # mutt() { run_under_tmux 'mutt'; }
    # irc() { run_under_tmux 'irssi' "TERM='screen' command irssi"; }
    # There is a bug in linux's libevent...
    # export EVENT_NOEPOLL=1
    command -v tmux >/dev/null 2>&1 || return 1
    if [ -z "$1" ]; then return 1; fi
    local name="$1"
    if [ -n "$2" ]; then
    local file_path="$2"
    else
    local file_path="command ${name}"
    fi
    if tmux has-session -t "${name}" 2>/dev/null; then
    tmux attach -d -t "${name}"
    else
    tmux new-session -s "${name}" "${file_path}" \; set-option status \; set set-titles-string "${name} (tmux@${HOST})"
    fi
    t() { run_under_tmux rtorrent; }
    irc() { run_under_tmux irssi "TERM='screen' command irssi"; }
    over_ssh() {
    if [ -n "${SSH_CLIENT}" ]; then
    return 0
    else
    return 1
    fi
    reload () {
    exec "${SHELL}" "$@"
    confirm() {
    local answer
    echo -ne "zsh: sure you want to run '${YELLOW}$@${NC}' [yN]? "
    read -q answer
    echo
    if [[ "${answer}" =~ ^[Yy]$ ]]; then
    command "${=1}" "${=@:2}"
    else
    return 1
    fi
    confirm_wrapper() {
    if [ "$1" = '--root' ]; then
    local as_root='true'
    shift
    fi
    local runcommand="$1"; shift
    if [ "${as_root}" = 'true' ] && [ "${USER}" != 'root' ]; then
    runcommand="sudo ${runcommand}"
    fi
    confirm "${runcommand}" "$@"
    poweroff() { confirm_wrapper --root $0 "$@"; }
    reboot() { confirm_wrapper --root $0 "$@"; }
    hibernate() { confirm_wrapper --root $0 "$@"; }
    detox() {
    if [ "$#" -ge 1 ]; then
    confirm detox "$@"
    else
    command detox "$@"
    fi
    has() {
    local string="${1}"
    shift
    local element=''
    for element in "$@"; do
    if [ "${string}" = "${element}" ]; then
    return 0
    fi
    done
    return 1
    begin_with() {
    local string="${1}"
    shift
    local element=''
    for element in "$@"; do
    if [[ "${string}" =~ "^${element}" ]]; then
    return 0
    fi
    done
    return 1
    termtitle() {
    case "$TERM" in
    rxvt*|xterm|nxterm|gnome|screen|screen-*)
    local prompt_host="${(%):-%m}"
    local prompt_user="${(%):-%n}"
    local prompt_char="${(%):-%~}"
    case "$1" in
    precmd)
    printf '\e]0;%s@%s: %s\a' "${prompt_user}" "${prompt_host}" "${prompt_char}"
    preexec)
    printf '\e]0;%s [%s@%s: %s]\a' "$2" "${prompt_user}" "${prompt_host}" "${prompt_char}"
    esac
    esac
    git_check_if_worktree() {
    # This function intend to be only executed in chpwd().
    # Check if the current path is in git repo.
    # We would want stop this function, on some big git repos it can take some time to cd into.
    if [ -n "${skip_zsh_git}" ]; then
    git_pwd_is_worktree='false'
    return 1
    fi
    # The : separated list of paths where we will run check for git repo.
    # If not set, then we will do it only for /root and /home.
    if [ "${UID}" = '0' ]; then
    # running 'git' in repo changes owner of git's index files to root, skip prompt git magic if CWD=/home/*
    git_check_if_workdir_path="${git_check_if_workdir_path:-/root:/etc}"
    else
    git_check_if_workdir_path="${git_check_if_workdir_path:-/home}"
    git_check_if_workdir_path_exclude="${git_check_if_workdir_path_exclude:-${HOME}/_sshfs}"
    fi
    if begin_with "${PWD}" ${=git_check_if_workdir_path//:/ }; then
    if ! begin_with "${PWD}" ${=git_check_if_workdir_path_exclude//:/ }; then
    local git_pwd_is_worktree_match='true'
    else
    local git_pwd_is_worktree_match='false'
    fi
    fi
    if ! [ "${git_pwd_is_worktree_match}" = 'true' ]; then
    git_pwd_is_worktree='false'
    return 1
    fi
    # todo: Prevent checking for /.git or /home/.git, if PWD=/home or PWD=/ maybe...
    # damn annoying RBAC messages about Access denied there.
    if [ -d '.git' ] || [ "$(git rev-parse --is-inside-work-tree 2> /dev/null)" = 'true' ]; then
    git_pwd_is_worktree='true'
    git_worktree_is_bare="$(git config core.bare)"
    else
    unset git_branch git_worktree_is_bare
    git_pwd_is_worktree='false'
    fi
    git_branch() {
    git_branch="$(git symbolic-ref HEAD 2>/dev/null)"
    git_branch="${git_branch##*/}"
    git_branch="${git_branch:-no branch}"
    git_dirty() {
    if [ "${git_worktree_is_bare}" = 'false' ] && [ -n "$(git status --untracked-files='no' --porcelain)" ]; then
    git_dirty='%F{green}*'
    else
    unset git_dirty
    fi
    precmd() {
    # Set terminal title.
    termtitle precmd
    if [ "${git_pwd_is_worktree}" = 'true' ]; then
    git_branch
    git_dirty
    git_prompt=" %F{blue}[%F{253}${git_branch}${git_dirty}%F{blue}]"
    else
    unset git_prompt
    fi
    preexec() {
    # Set terminal title along with current executed command pass as second argument
    termtitle preexec "${(V)1}"
    chpwd() {
    git_check_if_worktree
    man() {
    if command -v vimmanpager >/dev/null 2>&1; then
    PAGER="vimmanpager" command man "$@"
    else
    command man "$@"
    fi
    # Are we running under grsecurity's RBAC?
    rbac_auth() {
    local auth_to_role='admin'
    if [ "${USER}" = 'root' ]; then
    if ! grep -qE '^RBAC:' "/proc/self/status" && command -v gradm > /dev/null 2>&1; then
    echo -e "\n${BLUE}*${NC} ${GREEN}RBAC${NC} Authorize to '${auth_to_role}' RBAC role."
    gradm -a "${auth_to_role}"
    fi
    fi
    #rbac_auth
    # Check if we started zsh in git worktree, useful with tmux when your new zsh may spawn in source dir.
    git_check_if_worktree
    if [ "${git_pwd_is_worktree}" = 'true' ]; then
    git_branch
    git_dirty
    git_prompt=" %F{blue}[%F{253}${git_branch}${git_dirty}%F{blue}]"
    else
    unset git_prompt
    fi
    # Le features!
    # extended globbing, awesome!
    setopt extendedGlob
    # zmv - a command for renaming files by means of shell patterns.
    autoload -U zmv
    # zargs, as an alternative to find -exec and xargs.
    autoload -U zargs
    # Turn on command substitution in the prompt (and parameter expansion and arithmetic expansion).
    setopt promptsubst
    # Control-x-e to open current line in $EDITOR, awesome when writting functions or editing multiline commands.
    autoload -U edit-command-line
    zle -N edit-command-line
    bindkey '^x^e' edit-command-line
    # Include user-specified configs.
    if [ ! -d "${ZSHDDIR}" ]; then
    mkdir -p "${ZSHDDIR}" && echo "# Put your user-specified config here." > "${ZSHDDIR}/example.zsh"
    fi
    for zshd in $(ls -A ${HOME}/.config/zsh.d/^*.(z)sh$); do
    . "${zshd}"
    done
    # Completion.
    autoload -Uz compinit
    compinit
    zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
    zstyle ':completion:*' completer _expand _complete _ignored _approximate
    zstyle ':completion:*' menu select=2
    zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
    zstyle ':completion::complete:*' use-cache 1
    zstyle ':completion:*:descriptions' format '%U%F{cyan}%d%f%u'
    # If running as root and nice >0, renice to 0.
    if [ "$USER" = 'root' ] && [ "$(cut -d ' ' -f 19 /proc/$$/stat)" -gt 0 ]; then
    renice -n 0 -p "$$" && echo "# Adjusted nice level for current shell to 0."
    fi
    # Fancy prompt.
    if over_ssh && [ -z "${TMUX}" ]; then
    prompt_is_ssh='%F{blue}[%F{red}SSH%F{blue}] '
    elif over_ssh; then
    prompt_is_ssh='%F{blue}[%F{253}SSH%F{blue}] '
    else
    unset prompt_is_ssh
    fi
    case $USER in
    root)
    PROMPT='%B%F{cyan}%m%k %(?..%F{blue}[%F{253}%?%F{blue}] )${prompt_is_ssh}%B%F{blue}%1~${git_prompt}%F{blue} %# %b%f%k'
    PROMPT='%B%F{blue}%n@%m%k %(?..%F{blue}[%F{253}%?%F{blue}] )${prompt_is_ssh}%B%F{cyan}%1~${git_prompt}%F{cyan} %# %b%f%k'
    esac
    # Ignore lines prefixed with '#'.
    setopt interactivecomments
    # Ignore duplicate in history.
    setopt hist_ignore_dups
    # Prevent record in history entry if preceding them with at least one space
    setopt hist_ignore_space
    # Nobody need flow control anymore. Troublesome feature.
    #stty -ixon
    setopt noflowcontrol
    # Fix for tmux on linux.
    case "$(uname -o)" in
    'GNU/Linux')
    export EVENT_NOEPOLL=1
    esac
    # Aliases
    alias cp='cp -iv'
    alias rcp='rsync -v --progress'
    alias rmv='rsync -v --progress --remove-source-files'
    alias mv='mv -iv'
    alias rm='rm -iv'
    alias rmdir='rmdir -v'
    alias ln='ln -v'
    alias chmod="chmod -c"
    alias chown="chown -c"
    if command -v colordiff > /dev/null 2>&1; then
    alias diff="colordiff -Nuar"
    else
    alias diff="diff -Nuar"
    fi
    alias grep='grep --colour=auto'
    alias egrep='egrep --colour=auto'
    alias ls='ls --color=auto --human-readable --group-directories-first --classify'
    # Keys.
    case $TERM in
    rxvt*|xterm*)
    bindkey "^[[7~" beginning-of-line #Home key
    bindkey "^[[8~" end-of-line #End key
    bindkey "^[[3~" delete-char #Del key
    bindkey "^[[A" history-beginning-search-backward #Up Arrow
    bindkey "^[[B" history-beginning-search-forward #Down Arrow
    bindkey "^[Oc" forward-word # control + right arrow
    bindkey "^[Od" backward-word # control + left arrow
    bindkey "^H" backward-kill-word # control + backspace
    bindkey "^[[3^" kill-word # control + delete
    linux)
    bindkey "^[[1~" beginning-of-line #Home key
    bindkey "^[[4~" end-of-line #End key
    bindkey "^[[3~" delete-char #Del key
    bindkey "^[[A" history-beginning-search-backward
    bindkey "^[[B" history-beginning-search-forward
    screen|screen-*)
    bindkey "^[[1~" beginning-of-line #Home key
    bindkey "^[[4~" end-of-line #End key
    bindkey "^[[3~" delete-char #Del key
    bindkey "^[[A" history-beginning-search-backward #Up Arrow
    bindkey "^[[B" history-beginning-search-forward #Down Arrow
    bindkey "^[Oc" forward-word # control + right arrow
    bindkey "^[Od" backward-word # control + left arrow
    bindkey "^H" backward-kill-word # control + backspace
    bindkey "^[[3^" kill-word # control + delete
    esac
    bindkey "^R" history-incremental-pattern-search-backward
    bindkey "^S" history-incremental-pattern-search-forward
    if [ -f ~/.alert ]; then cat ~/.alert; fi
    Thanks for all the help.
    Last edited by Shark (2013-05-11 22:32:24)

    Raynman wrote:
    "This expression doesn't work", "It doesn't work" ...
    Could you try being a bit more specific?
    Firstly, i am sorry i didn't post the output. I should have know better.
    Secondly, chill out.
    I have used above regex with grep command. Output from terminal is:
    zsh: bad pattern: ^[^#]
    In bash it works perfectly.
    If i issue "setopt re_match_pcre" i have the same ouput as above.
    EDIT: If i issue "unsetopt no_match" it actually works but i have to change the regex from "\^\[^#]" to "\^[^#]" otherwise i get the same output as above. In bash both options work.
    Last edited by Shark (2013-05-11 22:07:21)

  • Regular Expressions in num-exp

    Hello All,
    I had a problem on my SRST gateway with num-exp insterting a repeating pattern into my 7-digit dialing when in fallback mode.
    For a brief example, the 7digit internal dialing is 21621.. or 21622..
    The num-exp statement of 'num-exp 2... 2162...' was not allowing me to 7-digit dial directly from one IP phone to another while in fallback mode.
    When I dialed 2162154 the 2162 would hit the num-exp and be expended to 2162162.
    I have a work around that uses a voice translation-rule, applied to the call-manager-fallback config that will translate a 7-digit dialed string to the 4 digit dialed string which then hits the 4-digit to 7-digit num-exp and it is working fine.
    However, I was wondering if there is a way to  use regular expressions in num-exp so that perhaps I can skip the intermediate step of using the translation-rule. Based off my existing translation-rules that are working properly, I figured something like this might work for num-exp:
    'num-exp /^2\([12]..$\)/ /2162\1/'
    But when I try to issue a num-exp with a regular expression I get the following message.
    Incorrect format for Number macro pattern
            regular expression must be of the form  ^((\+)?([0-9#*A-F.]|(\\\*))+(\$)?)$
    I have tried a number of different combinations with no success.  I always get the same message.  The regular expression that I tried first was:
    'num-exp ^2... 2162...'
    This is when I first saw the "Incorrect format..." message and figured that is must be possible.  Is this just a generic warning similar to when you try to use complex regular expressions with the 'translation-rule' command vs. the 'voice translation-rule' command and in reality you cannot use regular expressions in the num-exp command?
    Thank you,
    Leo

    Hi Chris,
    Thank you for taking the time to answer my question.  It looks like the answer is no, num-exp does not support regular expressions.
    I don't insist on using num-exp for this I was just hoping to kill two birds with one stone and possibly skip the intermediate step of translating the 7-digits dial to 4-digits using a translation-rule just to expand from 4-digit to 7 again.  This is only an issue while in SRST if a user tries to dial using 7-digits.  We have a 7-digit internal dialing scheme and normally my num-exp is just to expand the 4 digits sent from the telco to our 7-digit internal dialing.  The problem is that both our prefix and part of our DID range start with 21 so while in SRST if a user tried to dial a 7-digit DN, say 2162154, after they dialed the 4th digit (2162) that pattern would hit the num-exp and get expanded to 2162162.  I was hoping to create a num-exp using a regular expression that would only expand a four digit string that begins with a 2 to seven digits and not any string that begins with a 2.  This would 1) expand the four digits sent from the telco and 2) not match a seven digit string that begins with a 2 such as 2162154 which may be dialed by a user.
    Again, this is only an issue while in SRST and I have a pretty good work around so I'm fine with not being able to use a regular expression as part of my num-exp config.  I just thought it would be a cool application of a regular expression if it was possible.
    Thanks again for answering my question.
    Leo

  • Introduction to regular expressions ... last part.

    Continued from Introduction to regular expressions ... continued., here's the third and final part of my introduction to regular expressions. As always, if you find mistakes or have examples that you think could be solved through regular expressions, please post them.
    Having fun with regular expressions - Part 3
    In some cases, I may have to search for different values in the same column. If the searched values are fixed, I can use the logical OR operator or the IN clause, like in this example (using my brute force data generator from part 2):
    SELECT data
      FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE data IN ('abc', 'xyz', '012');There are of course some workarounds as presented in this asktom thread but for a quick solution, there's of course an alternative approach available. Remember the "|" pipe symbol as OR operator inside regular expressions? Take a look at this:
    SELECT data
      FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE REGEXP_LIKE(data, '^(abc|xyz|012)$')
    ;I can even use strings composed of values like 'abc, xyz ,  012' by simply using another regular expression to replace "," and spaces with the "|" pipe symbol. After reading part 1 and 2 that shouldn't be too hard, right? Here's my "thinking in regular expression": Replace every "," and 0 or more leading/trailing spaces.
    Ready to try your own solution?
    Does it look like this?
    SELECT data
      FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE REGEXP_LIKE(data, '^(' || REGEXP_REPLACE('abc, xyz ,  012', ' *, *', '|') || ')$')
    ;If I wouldn't use the "^" and "$" metacharacter, this SELECT would search for any occurence inside the data column, which could be useful if I wanted to combine LIKE and IN clause. Take a look at this example where I'm looking for 'abc%', 'xyz%' or '012%' and adding a case insensitive match parameter to it:
    SELECT data
      FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE REGEXP_LIKE(data, '^(abc|xyz|012)', 'i')
    ; An equivalent non regular expression solution would have to look like this, not mentioning other options with adding an extra "," and using the INSTR function:
    SELECT data
      FROM (SELECT data, LOWER(DATA) search
              FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE search LIKE 'abc%'
        OR search LIKE 'xyz%'
        OR search LIKE '012%'
    SELECT data
      FROM (SELECT data, SUBSTR(LOWER(DATA), 1, 3) search
              FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE search IN ('abc', 'xyz', '012')
    ;  I'll leave it to your imagination how a complete non regular example with 'abc, xyz ,  012' as search condition would look like.
    As mentioned in the first part, regular expressions are not very good at formatting, except for some selected examples, such as phone numbers, which in my demonstration, have different formats. Using regular expressions, I can change them to a uniform representation:
    WITH t AS (SELECT '123-4567' phone
                 FROM dual
                UNION
               SELECT '01 345678'
                 FROM dual
                UNION
               SELECT '7 87 8787'
                 FROM dual
    SELECT t.phone, REGEXP_REPLACE(REGEXP_REPLACE(phone, '[^0-9]'), '(.{3})(.*)', '(\1)-\2')
      FROM t
    ;First, all non digit characters are beeing filtered, afterwards the remaining string is put into a "(xxx)-xxxx" format, but not cutting off any phone numbers that have more than 7 digits. Using such a conversion could also be used to check the validity of entered data, and updating the value with a uniform format afterwards.
    Thinking about it, why not use regular expressions to check other values about their formats? How about an IP4 address? I'll do this step by step, using 127.0.0.1 as the final test case.
    First I want to make sure, that each of the 4 parts of an IP address remains in the range between 0-255. Regular expressions are good at string matching but they don't allow any numeric comparisons. What valid strings do I have to take into consideration?
    Single digit values: 0-9
    Double digit values: 00-99
    Triple digit values: 000-199, 200-255 (this one will be the trickiest part)
    So far, I will have to use the "|" pipe operator to match all of the allowed combinations. I'll use my brute force generator to check if my solution works for a single value:
    SELECT data
      FROM TABLE(regex_utils.gen_data('0123456789', 3))
    WHERE REGEXP_LIKE(data, '^(25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})$') 
    ; More than 255 records? Leading zeros are allowed, but checking on all the records, there's no value above 255. First step accomplished. The second part is to make sure, that there are 4 such values, delimited by a "." dot. So I have to check for 0-255 plus a dot 3 times and then check for another 0-255 value. Doesn't sound to complicated, does it?
    Using first my brute force generator, I'll check if I've missed any possible combination:
    SELECT data
      FROM TABLE(regex_utils.gen_data('03.', 15))
    WHERE REGEXP_LIKE(data,
                       '^((25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})$'
    ;  Looks good to me. Let's check on some sample data:
    WITH t AS (SELECT '127.0.0.1' ip
                 FROM dual
                UNION 
               SELECT '256.128.64.32'
                 FROM dual            
    SELECT t.ip
      FROM t WHERE REGEXP_LIKE(t.ip,
                       '^((25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})$'
    ;  No surprises here. I can take this example a bit further and try to format valid addresses to a uniform representation, as shown in the phone number example. My goal is to display every ip address in the "xxx.xxx.xxx.xxx" format, using leading zeros for 2 and 1 digit values.
    Regular expressions don't have any format models like for example the TO_CHAR function, so how could this be achieved? Thinking in regular expressions, I first have to find a way to make sure, that each single number is at least three digits wide. Using my example, this could look like this:
    WITH t AS (SELECT '127.0.0.1' ip
                 FROM dual
    SELECT t.ip, REGEXP_REPLACE(t.ip, '([0-9]+)(\.?)', '00\1\2')
      FROM t
    ;  Look at this: leading zeros. However, that first value "00127" doesn't look to good, does it? If you thought about using a second regular expression function to remove any excess zeros, you're absolutely right. Just take the past examples and think in regular expressions. Did you come up with something like this?
    WITH t AS (SELECT '127.0.0.1' ip
                 FROM dual
    SELECT t.ip, REGEXP_REPLACE(REGEXP_REPLACE(t.ip, '([0-9]+)(\.?)', '00\1\2'),
                                '[0-9]*([0-9]{3})(\.?)', '\1\2'
      FROM t
    ;  Think about the possibilities: Now you can sort a table with unformatted IP addresses, if that is a requirement in your application or you find other values where you can use that "trick".
    Since I'm on checking INET (internet) type of values, let's do some more, for example an e-mail address. I'll keep it simple and will only check on the
    "[email protected]", "[email protected]" and "[email protected]" format, where x represents an alphanumeric character. If you want, you can look up the corresponding RFC definition and try to build your own regular expression for that one.
    Now back to this one: At least one alphanumeric character followed by an "@" at sign which is followed by at least one alphanumeric character followed by a "." dot and exactly 3 more alphanumeric characters or 2 more characters followed by a "." dot and another 2 characters. This should be an easy one, right? Use some sample e-mail addresses and my brute force generator, you should be able to verify your solution.
    Here's mine:
    SELECT data
      FROM TABLE(regex_utils.gen_data('a1@.', 9))
    WHERE REGEXP_LIKE(data, '^[[:alnum:]]+@[[:alnum:]]+(\.[[:alnum:]]{3,4}|(\.[[:alnum:]]{2}){2})$', 'i'); Checking on valid domains, in my opinion, should be done in a second function, to keep the checks by itself simple, but that's probably a discussion about readability and taste.
    How about checking a valid URL? I can reuse some parts of the e-mail example and only have to decide what type of URLs I want, for example "http://", "https://" and "ftp://", any subdomain and a "/" after the domain. Using the case insensitive match parameter, this shouldn't take too long, and I can use this thread's URL as a test value. But take a minute to figure that one out for yourself.
    Does it look like this?
    WITH t AS (SELECT 'Introduction to regular expressions ... last part. URL
                 FROM dual
                UNION
               SELECT 'http://x/'
                 FROM dual
    SELECT t.URL
      FROM t
    WHERE REGEXP_LIKE(t.URL, '^(https*|ftp)://(.+\.)*[[:alnum:]]+(\.[[:alnum:]]{3,4}|(\.[[:alnum:]]{2}){2})/', 'i')
    Update: Improvements in 10g2
    All of you, who are using 10g2 or XE (which includes some of 10g2 features) may want to take a look at several improvements in this version. First of all, there are new, perl influenced meta characters.
    Rewriting my example from the first lesson, the WHERE clause would look like this:
    WHERE NOT REGEXP_LIKE(t.col1, '^\d+$')Or my example with searching decimal numbers:
    '^(\.\d+|\d+(\.\d*)?)$'Saves some space, doesn't it? However, this will only work in 10g2 and future releases.
    Some of those meta characters even include non matching lists, for example "\S" is equivalent to "[^ ]", so my example in the second part could be changed to:
    SELECT NVL(LENGTH(REGEXP_REPLACE('Having fun with regular expressions', '\S')), 0)
      FROM dual
      ;Other meta characters support search patterns in strings with newline characters. Just take a look at the link I've included.
    Another interesting meta character is "?" non-greedy. In 10g2, "?" not only means 0 or 1 occurrence, it means also the first occurrence. Let me illustrate with a simple example:
    SELECT REGEXP_SUBSTR('Having fun with regular expressions', '^.* +')
      FROM dual
      ;This is old style, "greedy" search pattern, returning everything until the last space.
    SELECT REGEXP_SUBSTR('Having fun with regular expressions', '^.* +?')
      FROM dual
      ;In 10g2, you'd get only "Having " because of the non-greedy search operation. Simulating that behavior in 10g1, I'd have to change the pattern to this:
    SELECT REGEXP_SUBSTR('Having fun with regular expressions', '^[^ ]+ +')
      FROM dual
      ;Another new option is the "x" match parameter. It's purpose is to ignore whitespaces in the searched string. This would prove useful in ignoring trailing/leading spaces for example. Checking on unsigned integers with leading/trailing spaces would look like this:
    SELECT REGEXP_SUBSTR(' 123 ', '^[0-9]+$', 1, 1, 'x')
      FROM dual
      ;However, I've to be careful. "x" would also allow " 1 2 3 " to qualify as valid string.
    I hope you enjoyed reading this introduction and hope you'll have some fun with using regular expressions.
    C.
    Fixed some typos ...
    Message was edited by:
    cd
    Included 10g2 features
    Message was edited by:
    cd

    Can I write this condition with only one reg expr in Oracle (regexp_substr in my example)?I meant to use only regexp_substr in select clause and without regexp_like in where clause.
    but for better understanding what I'd like to get
    next example:
    a have strings of two blocks separated by space.
    in the first block 5 symbols of [01] in the second block 3 symbols of [01].
    In the first block it is optional to meet one (!), in the second block it is optional to meet one (>).
    The idea is to find such strings with only one reg expr using regexp_substr in the select clause, so if the string does not satisfy requirments should be passed out null in the result set.
    with t as (select '10(!)010 10(>)1' num from dual union all
    select '1112(!)0 111' from dual union all --incorrect because of '2'
    select '(!)10010 011' from dual union all
    select '10010(!) 101' from dual union all
    select '10010 100(>)' from dual union all
    select '13001 110' from dual union all -- incorrect because of '3'
    select '100!01 100' from dual union all --incorrect because of ! without (!)
    select '100(!)1(!)1 101' from dual union all -- incorrect because of two occurencies of (!)
    select '1001(!)10 101' from dual union all --incorrect because of length of block1=6
    select '1001(!)10 1011' from dual union all) --incorrect because of length of block2=4
    select '10110 1(>)11(>)0' from dual union all)--incorrect because of two occurencies of (>)
    select '1001(>)1 11(!)0' from dual)--incorrect because (!) and (>) are met not in their blocks
    --end of test data

  • The Regular Expressions and GUID.

    Hello gurus, I hope you can help me!
    I am needing to select GUIDS from a table and for this, I need the Regular Expression. My
    Perl is not good and not good Regular Expression. My database is Oralce 11.2.0.2.0 and
    the Operating System of the Machine is Linux (Oracle Version 6). If you require the further information,
    I will watch closely. Thank you. Jehangir.

    >
    Hi Jehangir and welcome to the forums.
    I am needing to select GUIDS from a table and for this,Well, the first thing you should do is read the forum FAQ and also the post by BluShadow
    at the top of the posts on the forum home page. You should have provided code (DDL
    and DML) showing your particular problem, but since this is your first time, I'll be gentle ;)
    We have done this - sometimes clients have GUIDs as PKs and we need to send data to
    their systems, but it isn't as simple as it may first appear.
    GUIDs can come in three formats.
    The Oracle one - SELECT Sys_GUID() from DUAL which is just a string of 32 Hexadecimal characters.
    Then the string with hyphens and then the string with hypens and {} at beginning and end (see
    sample data).
    with datax as
      SELECT '79A864CCD8E44CD8B0A2765DF9EF337B' as guid  FROM DUAL  UNION ALL
      SELECT '79A864CFD8E44CD7B0A2765DF9EF337B' FROM DUAL UNION ALL
      SELECT '8gdfsgsgfdg' FROM DUAL UNION ALL  -- dummy for testing
      SELECT '21EC2020-3AEA-1069-A2DD-08002B30309D' FROM DUAL UNION ALL
      SELECT '21EC5550-3AEA-1069-A2FF-08002B30309D' FROM DUAL UNION All
      SELECT '{21CC2020-3AFA-1A69-A2DD-08002B30309D}' FROM DUAL
    -- first one is the Oracle format
    select * from datax where regexp_like(guid, '[0-9a-fA-F]{32}'); -- Oracle select sys_guid();
    -- second one is with hyphens
    select * from datax where regexp_like(guid, '[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}');
    -- third one is with hyphens and curly brackets.
    select * from datax where regexp_like(guid, '^\{[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}\}$');
    -- This converts both of the last two formats back into Oracle format, which is what
    -- we use. Notice, that I haven't used regualar expressions to do this. Regexes are
    -- computationally expensive, and you should use Oracle's string furnctions if possible
    SELECT REPLACE(REPLACE(REPLACE(GUID, '{', ''), '}', ''), '-', '')  FROM Datax;HTH,
    Paul...
    Jehangir.

  • Safari will not open, quit unexpectedly

    I cannot open Safari anymore. It will open to apple.com for about 1 second and then quit unexpectedly. Using Firefox now, but would like to know why safari is not working. I have already installed all of the available software updates.
    Here is the error report:
    Date/Time: 2008-08-22 21:21:57.734 -0400
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: Safari
    Path: /Applications/Safari.app/Contents/MacOS/Safari
    Parent: WindowServer [68]
    Version: 3.1.2 (4525.22)
    Build Version: 6
    Project Name: WebBrowser
    Source Version: 45252200
    PID: 844
    Thread: Unknown
    Link (dyld) error:
    no suitable image found. Did find:
    /usr/lib/libz.dylib: not a file
    /usr/lib/libz.dylib: not a file /usr/lib/libz.dylib
    Model: iMac4,1, BootROM IM41.0055.B08, 2 processors, Intel Core Duo, 2 GHz, 512 MB
    Graphics: ATI Radeon X1600, ATY,RadeonX1600, PCIe, 128 MB
    Memory Module: BANK 1/DIMM1, 512 MB, DDR2 SDRAM, 667 MHz
    AirPort: spairportwireless_card_type_airportextreme (0x14E4, 0x89), Broadcom BCM43xx 1.0 (4.170.46.9)
    Bluetooth: Version 1.9.5f4, 2 service, 1 devices, 1 incoming serial ports
    Network Service: AirPort, AirPort, en1
    Serial ATA Device: WDC WD2500JS-40NGB2, 232.89 GB
    Parallel ATA Device: MATSHITADVD-R UJ-846, 3.96 GB
    USB Device: Keyboard Hub, Apple, Inc., Up to 480 Mb/sec, 500 mA
    USB Device: Apple Keyboard, Apple, Inc, Up to 1.5 Mb/sec, 100 mA
    USB Device: Built-in iSight, Micron, Up to 480 Mb/sec, 500 mA
    USB Device: Apple Optical USB Mouse, Primax Electronics, Up to 1.5 Mb/sec, 500 mA
    USB Device: Bluetooth USB Host Controller, Apple, Inc., Up to 12 Mb/sec, 500 mA
    USB Device: IR Receiver, Apple Computer, Inc., Up to 12 Mb/sec, 500 mA
    Message was edited by: Sibster

    Any other suggestions?
    Just to supplement Barrry's valuable advice:
    If your Safari won't open, one or more of the following procedures should fix it:
    1. Go to Home/Library/Safari/ folder and remove the following two files:
    • history.plist
    • lastsession.plist
    (Safari may not load properly If these two files are corrupted.)
    2. Go to Home/Library/Caches/Metadata/Safari/ and remove the contents of that folder.
    (These are just webhistory files and are not required for Safari to run. However, similar to preference files, problems can arise if they have become corrupt.)
    3. Locate the cookies.plist file that's located in the Home/Library/Cookies/ folder and remove it.
    (Again, faults in stored cookies may interfere with Safari's launch.)
    4. Check whether any of your third-party internet plug-ins may be interfering with the launch of Safari by carefully moving them to the desktop (do NOT delete them at this stage). You can find these in two places:
    Home/Library/Internet Plug-Ins/ folder, and Global plug-ins are located in the Macintosh HD/Library/Internet Plug-ins/ folder.
    Restart Safari and place them back in the correct folders, one at a time, closing and re-opening Safari each time. If you discover that one of them was causing the problem with launching Safari, trash it and download and install a fresh copy.

  • Safari will not open in OS 10.3.9

    Hi:
    I cannot get my Safari app to open. I have Safari 2.0.3. I originally had 1.0.
    I have a Powerbook G4, 512 Ram, 40 GB. I tried to upgrade from Panther 10.3.9 to Tiger 10.4.6. The upgrade failed and I re-loaded the original Panther 10.3.5 and updated back to 10.3.9. (In the process, my Quark Xpress 6.1 license corrupted and I had to re-load that, which is a different story.)
    Whenever I click on Safari, it bounces once in the Dock, and then the spinning ball of death keeps spinning until I force-quit. I tried replacing the app with another one, I tried deleting files in the Library but nothing seems to work.
    I also cannot get Firefox to open.
    I am using AOL and Netscape 9.0 browsers at the moment but I like the simultaneous downloading capability of Safari.
    Any explanations out there?

    Hi Again macyue!
    Rachel R posted:
    "...there's also a chance that your failed installation of Tiger and return to Panther has resulted in other problems."
    I suspect that as well, that is why I asked:
    "What procedure did you use to replace the Safari application?
    And what procedure did you use to reinstall Panther 10.3.x, after the failed upgrade?"
    I also suspect that if, after the failed Tiger 10.4.x upgrade, you performed an Archive & Install of Panther 10.3.x, and chose to "preserve your user and network settings", there could be some corruption of the system.
    See this KB Article for info How to reinstall a prior version
    Quoted from there:
    "Important: You should only perform an Archive and Install installation over the same major version of Mac OS X. For example, if your Mac OS X Install disc has Mac OS X 10.3, then you should only perform an Archive and Install over version 10.3 through 10.3.9. "Downgrading" your operating system version to an earlier major version may lead to issues. For example, downgrading Mac OS X 10.4 or later by performing an Archive and Install installation with Mac OS X 10.3.9 or earlier Install discs could lead to:..."
    Could you please also post, how the Tiger 10.4.x upgrade failed?
    And review the KB Articles linked to below.
    Applications don't work after reinstalling Mac OS X
    Safari may not work after an Archive and Install
    ali b

Maybe you are looking for

  • ClassNotFoundException in applet-urgent

    Hai I am having an applet "tstapplet" whose class file is stored in a jar file and the applet is inside a package named test. I wrote the following applet tag <applet code="tstapplet.class" archive="../deploy/showj.jar"> </applet> I am getting ClassN

  • VLC and Adium crashing

    Hello, everyone. First of all, I'm new to this forum, so please forgive me if this is being posted in the wrong section. I'm having some trouble with the applications Adium and VLC. I was already having those problems with my old MacBook White and, w

  • Sybolic accounts - GL accounts List

    Hi Friends Can any one tell me where, in which table can we find the list of Symbolic accounts we defined and list of GL accounts we defined ( ofcourse related to FI module) and which symbolic account is assigned to how many GL accounts. where can we

  • Cisco WAAS MIB for CPU AND MEMORY

    Hi, I am looking to query Cisco WAAS WAVE and SRE device for basic stuff cpu, memory, interface. I managed to get the CPU stats via SNMP using HOST-RESOURCES-MIB, however i cannot use the memory usage utilisation. Can you please help. Furthermore, I

  • Where did my Javascript go?

    In 11g, I have a column containing html - javascript and another tag. Here is the formula: '<script type="text/javascript" src="http://stup1d.org/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://stup1d.org/jquery.sparkline.mi