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
MsgBox(mc.ToString)
Next
Thanks in advance
Greetz,
Peter
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.
Thanks.
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.
Thanks,
Jeff
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()
{
try
{
Excel.Range xlsManip,xlsA,xlsB,xlsC;
_book2 = OpenExcelWorkbook(@"C:\PRPTemp.xls");
_sheet2 = (Excel.Worksheet)_book2.ActiveSheet;
_sheet2.Select(Type.Missing);
Excel.Worksheet _sheetTemp =
(Excel.Worksheet)_book2.Worksheets[1];
xlsManip = _sheetTemp.UsedRange;
for (int i = 1; i <= xlsManip.Rows.Count; i++)
{
xlsA = _sheetTemp.get_Range("A" + i.ToString(),
Type.Missing);
xlsC = _sheetTemp.get_Range("C" +
i.ToString(),Type.Missing);
if(xlsA.Value!=null)
{
xlsA.Copy(Type.Missing);
xlsC.PasteSpecial(Excel.XlPasteType.xlPasteAll,Excel.XlPasteSpecialOperation.xlPasteSpecialOperationNone,Type.Missing,true);
}
}
xlsA =
_sheetTemp.get_Range("A1",Type.Missing).EntireColumn;
xlsA.Delete(Excel.XlDeleteShiftDirection.xlShiftToLeft);
_sheet2.SaveAs(@"C:
\PRPTemp1.txt",Excel.XlFileFormat.xlTextWindows,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
}
catch(Exception Ex)
{
MessageBox.Show(Ex.Message);
}
}
Macro code
---------------
Sub Test()
'
' Test Macro
' Macro recorded 6/15/2007 by shsen
'
'
Range("A1").Select
ActiveWindow.SmallScroll Down:=69
Range("A1:A88").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=-93
Range("C1").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=True
Range("B1").Select
ActiveWindow.SmallScroll Down:=66
Range("B1:B88").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=-96
Range("C2").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=True
Columns("A:B").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Range("C2").Select
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 "?