Text Lines and Text Areas

[COLOR=“DarkOrchid”][SIZE=“2”]Is there a way to set a maximum characters including spaces in the option text and text areas ? I thought someone mentioned it at one time, but can’t find any documentation with any reference to this…

Thanks in advance…[/SIZE][/COLOR]


I mentioned it dawn. I use regular expressions. I got some samples and change them to suit me, but I don’t really understand the syntax.

Here are two that I use ( but don’t ask me what anything mean!):

^([^\r\n]{0,10}(\r?\n|$)){1,4}$ - -Up to 4 lines no more than 10 characters per line

^([^\r\n]{0,15}(\r?\n|$)){1,4}$ - Up to 4 lines, maximum of 15 Characters per line.

^([0-9a-zA-Z!@#$%^&*()-_=+ ]){0,14}$ - This allows up to 14 characters, I use this in a text field for one line. I guess if you put it in a text area, you can put many lines, but only 14 characters each line.

At this time, I just use trial and errors, until I get what I want.



^ = beginning of line

$ = end of line

\r\n = new line (enter key when using windows format)

? = any character

| = or

() = search group

[] = choose one from this group

[^] = choose anything NOT in this group

{0,10} = choose 0 to 10 of the items preceding it (i.e. CS[-Cc]{1,2}art ).

So this means: ^([^\r\n]{0,10}(\r?\n|$)){1,4}$

Start at the beginning of the text (^).

Choose 0 to 10 of anything besides an end of line [^\r\n]{0,10}. Afterwards, look for either a windows or unix newline (\r?\n|$) or the end of the text ($).

Repeat this process 1 to 4 times {1,4} until we reach the end of the text ($).

Thanks gginorio,

Also, there is information in the knowledge base including a link to a “cheat sheet”

[URL=“CS-Cart Documentation — CS-Cart 4.15.x documentation”]CS-Cart Documentation — CS-Cart 4.15.x documentation


[COLOR=“DarkOrchid”][SIZE=“2”]Thanks guys…but I am totally lost :confused: This is far from my area of expertise…

I am guessing I put this in the option RegExp line set up box. What I need is a maximum of 2 lines with a maximum of 20 or 24 characters including spaces. If I put just one text area, how does it differentiate how many lines and characters ?

I really appreciate your help on this…I will be so tickled when I can make this work.

I kinda thought it was you Bob…but wasn’t quite sure :slight_smile: [/SIZE][/COLOR]


I will send you a pm to a product on my dev site that I am testing the regexp.

You can check the different fields to see.