+ Reply to Thread
Results 1 to 8 of 8

Regular Expression - String comparsion

  1. #1
    Registered User
    Join Date
    02-07-2013
    Location
    Irvine, California
    MS-Off Ver
    Excel 2003
    Posts
    9

    Regular Expression - String comparsion

    Hi,

    I want to match and get the text between word SEVERITY and APPLICATION in the below text using regular expressions.

    "SYNTAX_VERSION 6 ADVMONITOR ""CG-DBSPI-3215"" DESCRIPTION ""% of space used on a specific virtual device(M215_VirtDevSpUsdPct)"" SEPARATORS "" "" SEVERITY Normal APPLICATION ""MSSQL Server"" MSGGRP ""DBSPI"" HELPTEXT "" Probable Cause(s): Allocated storage is approaching total storage with the potential impact the inability to extend databases. CONDITION THRESHOLD 99.000000 SETSTART SEVERITY Critical APPLICATION "MSSQL Server" MSGGRP "MSS_Admin" SERVICE_NAME "SQL_Server_<$OPTION(server)>_@@<$MSG_NODE_ID>"

    Thanks in Advance
    Thanks,
    Snail

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Regular Expression - String comparsion

    Between the first instance of SEVERITY and the last instance of APPLICATION?

    Any particular reason to want to use a RegExp other than the snail aspect?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    02-07-2013
    Location
    Irvine, California
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Regular Expression - String comparsion

    anything will work though its my part of requirement

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Regular Expression - String comparsion

    A
    B
    1
    "SYNTAX_VERSION 6 ADVMONITOR ""CG-DBSPI-3215"" DESCRIPTION ""% of space used on a specific virtual device(M215_VirtDevSpUsdPct)"" SEPARATORS "" "" SEVERITY Normal APPLICATION ""MSSQL Server"" MSGGRP ""DBSPI"" HELPTEXT "" Probable Cause(s): Allocated storage is approaching total storage with the potential impact the inability to extend databases. CONDITION THRESHOLD 99.000000 SETSTART SEVERITY Critical APPLICATION "MSSQL Server" MSGGRP "MSS_Admin" SERVICE_NAME "SQL_Server_<$OPTION(server)>_@@<$MSG_NODE_ID>" Normal APPLICATION ""MSSQL Server"" MSGGRP ""DBSPI"" HELPTEXT "" Probable Cause(s): Allocated storage is approaching total storage with the potential impact the inability to extend databases. CONDITION THRESHOLD 99.000000 SETSTART SEVERITY Critical


    The formula in B1 is

    =Between(A1, "Severity", "Application")

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-07-2013
    Location
    Irvine, California
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Regular Expression - String comparsion

    let me explain this bit clearly,

    I need the below highlighted in different cells. Output should be Normal (in one cell), Critical (in next cell)

    "SYNTAX_VERSION 6 ADVMONITOR ""CG-DBSPI-3215"" DESCRIPTION ""% of space used on a specific virtual device(M215_VirtDevSpUsdPct)"" SEPARATORS "" "" SEVERITY Normal APPLICATION ""MSSQL Server"" MSGGRP ""DBSPI"" HELPTEXT "" Probable Cause(s): Allocated storage is approaching total storage with the potential impact the inability to extend databases. CONDITION THRESHOLD 99.000000 SETSTART SEVERITY Critical APPLICATION "MSSQL Server" MSGGRP "MSS_Admin" SERVICE_N

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Regular Expression - String comparsion

    That's why I asked:

    Between the first instance of SEVERITY and the last instance of APPLICATION?

  7. #7
    Registered User
    Join Date
    02-07-2013
    Location
    Irvine, California
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Regular Expression - String comparsion

    ohh...haven't read properly....hope its clear now.... any way to hit this?

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Regular Expression - String comparsion

    Hello VBA-Snail,

    Here is an example macro using Regular Expressions to parse the words into separate cells. It assumes "A1" contains the string. The output is across the columns of the same row.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Regular Expression Pattern All Letters In String
    By goss in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-05-2013, 12:13 AM
  2. [SOLVED] Find a string by VBA Regular Expression and replace a part of that string
    By taps in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-25-2013, 11:08 AM
  3. [SOLVED] Regular Expression
    By Kvramana in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2013, 05:32 AM
  4. Replies: 0
    Last Post: 10-04-2012, 04:16 AM
  5. Using a regular expression to pull out data from a string
    By mundo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-12-2008, 07:42 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1