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

Regex to Substring without cutting off word

I'm trying to figure out a regex which will act as a substring but not cut off words.  For example, I want to take a substring of 0 to x chars in a description but do not cut off any word.\

so something like give me 0 to x chars but cut off anything that's only one character toward the end type of deal so that I do not end up with a single character or soemthing else at the end of the description.
0
dba123
Asked:
dba123
  • 2
1 Solution
 
ozoCommented:
.{0,x}\b
0
 
ozoCommented:
.{0,x}(?!.$)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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