• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1206
  • Last Modified:

Regular Expression Pattern

How is a pattern that matches a semicolon (";") - followed by one or none spaces (" "), either in the beginning of the string, or in the beginning of a new line.

I have currently come up with "\n; ?", but that does not match a semicolon in the beginning of the whole string.
0
Joakim_
Asked:
Joakim_
  • 2
  • 2
1 Solution
 
eeBlueShadowCommented:
Which language are you using?
0
 
Joakim_Author Commented:
ASP (VBScript).
0
 
eeBlueShadowCommented:
OK, the reason I asked was that some languages treat multiline text (text with newline characters in it) differently.

Normally, ^ matches at the start of a string. In multiline text, it matches at the start of every line, unless the Multiline option is set for the Regex (I don't know how you set options for regex in ASP).

If you only wanted to search at the start of the string (NOT every line) you could alter the multiline setting, or use the \A metacharacter.

So, "^; " should do what you want.
_Blue
0
 
Joakim_Author Commented:
Thank you, I didn't know about that Multiline option, but now, I know how to set it.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now