473,324 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

VB.Net Regex finding multiple capital letters in a word

36
I'm trying to create a regex to find more than one capital letter position within a word. The below regex, finds the first capital letter in the word and returns the index for that character. I would like to find both capital letter positions in the word heLLo and return both positions. Does anyone have any suggestions.

Thanks in advance,
Wbos


Public Function FindPosition(ByVal word As String)

' Create a new Regex object.
Dim r2 As New Regex("[A-Z] ")

' Find a single match in the input string.
Dim m2 As Match = r2.Match(word)

If m2.Success Then

' Print out the character position where a match was found.

' (For heLLo the character position 2 is the result.)
MsgBox("Found match at position " & m2.Index.ToString())

End If

Return m2.Index
End Function
Nov 5 '07 #1
0 2657

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Christoph Pingel | last post by:
Hi all, an interesting problem for regex nerds. I've got a thesaurus of some hundred words and a moderately large dataset of about 1 million words in some thousand small texts. Words from the...
6
by: Vishant | last post by:
Hi, I'm new to javascript and regEx and trying to solve the following problem. I have a function which validates the password if there is a number:...
2
by: B Moor | last post by:
I have a database with 100,000's records, each with a unique reference, eg A123BNK456 I would like to generate a search facility whereby we can choose an exact match or partial match, where the...
17
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher ...
2
by: Morten Snedker | last post by:
In another thread I found this snippet for validating an e-mail: ^(+)@((\{1,3}\.{1,3}\.{1,3}\.)|((+\.)+))({2,4}|{1,3})(\]?)$ Would someone please help to read this? I don't get the slashes,...
17
by: Mark | last post by:
I must create a routine that finds tokens in small, arbitrary VB code snippets. For example, it might have to find all occurrences of {Formula} I was thinking that using regular expressions...
6
by: Lubomir | last post by:
Hi, I am using the following pattern: "\\b" + MySttring + "\\b" If MyString is "one", this should pick up whole words like "one". The problem is, it will pick up also the word: "one.two"...
10
by: igor.kulkin | last post by:
I have a small utility program written in Python which works pretty slow so I've decided to implement it in C. I did some benchmarking of Python's code performance. One of the parts of the program...
3
by: =?Utf-8?B?TmF2ZWVu?= | last post by:
Not sure if this is the right forum for this question but couldn'd find another newsgroup. I am new to Regular expressions and would like help in deciding which pattern allows me to split a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.