RegEx and special range metacharaacters



  • 1. How to use StructToPtr with SendMessage?
    In my C# library I have many SendMessages like the following: [DllImport("user32.dll", EntryPoint="SendMessage",CharSet=CharSet.Auto )] public static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, ref PARAFORMAT2 pf2); I use this one like this: Dim lSelectedParagraph As PARAFORMAT2 Rtf.SendMessage(gctlText.TxtHandle, Rtf.EM_GETPARAFORMAT, 0, lSelectedParagraph) So that I do not need to define a SendMesage for each usage, I think I could define: [DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]public static extern int SendMessage( IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] int Msg,IntPtr wParam, IntPtr lParam); Could someone show me how to write the VB SendMessage call that will use this SendMessage?? I think if I have one example I can figure out how to do the others, Thanks in advance Thanks
  • 2. Building a report builder
    Hi, I have been given the task of building a client side report builder in VB.NET. The GUI will have to be for the not-so-computer literate type of user. I was thinking about making the GUI similar to the one in the MS Access design view for queries. Does anyone know of examples, resources, or any other type of help that will assist me with this task. Thanks in advance.
  • 3. Get information on who starts program
    Hi. Is it possible to get information on who starts my program? The program is to be set to run as a service, but I also wish to create a user interface to use when the program is started manually. So, is it possible to see if it's being run as a service or if someone else started the program? Thanks, Shawn
  • 4. Installation help
    What is the right group to ask help on "Setup and Deployment Projects..".. If it is.. can anybody tell me if I can do the below with a Setup and Deployment project that ships with VS.NET 2003 I need one of my executables that Aim installing with my package to the Windows Run key (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run) in the registery.. Thanks VJ

RegEx and special range metacharaacters

Postby sd » Wed, 24 Dec 2003 03:45:27 GMT

Are any of the special range metacharacters allowed in 
RegEx operations(System.Text.RegularExpressions) . If so 
how could you please specify an example.


[:digit:] Only the digits 0 to 9 
[:alnum:] Any alphanumeric character 0 to 9 OR A to Z or a 
to z. 
[:alpha:] Any alpha character A to Z or a to z. 
[:blank:] Space and TAB characters only. 
[:xdigit:] . 
[:punct:] Punctuation symbols . , " ' ? ! ; : 
[:print:] Any printable character. 
[:space:] Any space characters. 
[:graph:] . 
[:upper:] Any alpha character A to Z. 
[:lower:] Any alpha character a to z. 
[:cntrl:] . 

Similar Threads:

1.Regex question find words that start with special char

Hi group first of all I need to say that I almost never use regex hence 
my question may be stupid.
I'm using regex to find all words that start with an @ in a string.
But the regex that I figured doesn't work. can anyone help me.

Dim myReg As New Regex("\b@\w*\b")
Dim mcCol As MatchCollection
Dim mc As Match
     mcCol = myReg.Matches("@param1 @param2 @test +56 -23 *25)
     'I would like to get @param1 and @param2 and @test
     For Each mc In mcCol

Thanks in advance



2.RegEx - Validate Excel Range

Any thoughts on how to validate an Excel range with RegEx? 
Acceptable inputs would include $A1:$BD25, C:C, B4 etc.
I'm close to coming up with an answer but I'm not sure how to stop
invalid range references such as C3:A2 from being accepted.


3.regex: the supported Unicode groups and block ranges?

The regex has a "\p{name}" character class ,In msdn the Description is 
"Matches any character in the named character class specified by {name}. 
Supported names are Unicode groups and block ranges. For example, Ll, Nd, Z, 
IsGreek, IsBoxDrawing.".

But there is no more informations about the Unicode groups and block ranges 
it supports.
Where can I find the Supported names list? 

4.RegEx Range.Text object corrupting embedded footnotes

I have a macro which processes text using Regular Expressions (to find run-in 
heads in paragraphs). It seems that regular expressions will only work on the 
Range.Text object and not Range.FormattedText. I thought I had most of the 
kinks worked out of this but found a new wrinkle yesterday. It seems that, if 
the text of a paragraph is altered by a RegEx, then the embedded footnotes in 
that paragraph are broken. I have a sense that this is because the proper 
information isn't be passed back to the document by the Range.Text object 
when a replacement is made (duh). Before I sit down and write a macro that 
cuts out the embedded footnotes and replaces them with a marker before the 
RegEx is run and then reverses the replacement after the RegEx is run, I 
thought I would check with the experts and see if there are any better (and 
easier) approaches out there.

I have tried replacing the RegEx searches with S/R using Word's wildcard 
search options but can't achieve the desired search complexity with them. I 
always run into the "expression is to complex" error. As a side question, are 
the limitations of Word's Wildcard Search listed anywhere. The one major one 
I've encountered is the limitation to 7 groups instead of the regular 9. 
There seem to be others but I can't recall them right now.

Anyway, any suggestions would be appreciated.



5.Excel.Range.Paste Special - Transpose not working

I am trying to convert a macro code to c# that will copy the values of
a column and paste to anather through paste special. Everything is
working fine but the transpose meathod to paste the column value as
row value is not working. Can someone kindly look into the code, if i
am missing something.

C# Code
private void ManipulateXLS()
                Excel.Range xlsManip,xlsA,xlsB,xlsC;
                _book2 = OpenExcelWorkbook(@"C:\PRPTemp.xls");
                _sheet2 = (Excel.Worksheet)_book2.ActiveSheet;
                Excel.Worksheet _sheetTemp =
                xlsManip = _sheetTemp.UsedRange;
                for (int i = 1; i <= xlsManip.Rows.Count; i++)
                    xlsA = _sheetTemp.get_Range("A" + i.ToString(),
                   xlsC = _sheetTemp.get_Range("C" +
                xlsA =

            catch(Exception Ex)

Macro code
Sub Test()
' Test Macro
' Macro recorded 6/15/2007 by shsen

    ActiveWindow.SmallScroll Down:=69
    ActiveWindow.SmallScroll Down:=-93
    Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
        , Transpose:=True
    ActiveWindow.SmallScroll Down:=66
    Application.CutCopyMode = False
    ActiveWindow.SmallScroll Down:=-96
    Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
        , Transpose:=True
    Application.CutCopyMode = False
    Selection.Delete Shift:=xlToLeft
End Sub

6. Range.Text method and problem with special chars

7. How to set special range of pages to be visible

8. Range object and Special char "?

Return to VB.NET


Who is online

Users browsing this forum: No registered users and 71 guest