CSS/JS - Force a line break at a comma in comma separated list - css

I have a table cell in which there is list of aircraft registration numbers in the format 'X-XXXX'. The width of the table cell means that the list gets word-wrapped on the hyphen, like so:
G-ABCD,G-
EFGH,G-
IJKL
What I'd like to happen is that the line-break is forced on the comma:
G-ABCD,
G-EFGH,
G-IJKL
However, I cannot insert any special characters. This is because when the form is submitted, the data in the table is submitted as JSON format which is then json_decoded in PHP. Any special characters in the comma separated string then stops the json_decode function from turning it into an array.
So I really need a solution that does not alter the list in anyway? Sounds impossible...

To force a line break, use the <br> tag. If you cannot have it in the HTML markup, add it with JavaScript.
This answers the question asked. The actual problem is probably different. You need to post more code and ask differently to have it solved. What is the context, what are the constraints, and what do you actually want to do? (From the discussion in the comments, it seems that you rather want to prevent line breaks after hyphens than force any breaks.)

Related

How to check an "empty" fill-in field which is not empty due to the format?

I have a window, containing some fill-in fields. One of them is meant to contain a date, having 99/99/9999 as a format. Due to that format, when emptying the field (selecting the content and press the DEL button), I see "__/__/____" on screen (the underscores mean spaces).
In order to check if this fill-in field is empty, currently the source code does this as follows:
IF Date_Fill-In:SCREEN-VALUE <> "/ /"
As you can see, this is heavily dependent on the format of the fill-in field.
Is there a built-in function I can use to check if the screen-value of a fill-in field is empty, without needing to check the format?
Thanks in advance
Dominique
Check for the INPUT-VALUE property returning ?.

how can I join two regex into one?

I have two regex that I need to join into one as I am using the RegularExpressionAttribute in ASP.NET and it does not allow multiple instances.
How can I join the following two regex into one?
.*?#(?!.*?\.\.)[^#]+$
[\x00-\x7F]
the first one checks that there are not 2 consecutive dots in the domain part of an email and the second regex checks that all characters are ascii
I thought it might have been as easy as joining them together like (.*?#(?!.*?\.\.)[^#]+$)([\x00-\x7F]) but this does not work
Here is link to previous post relating to this problem
EDIT: I am decorating an string property of my viewmodel using reglarexpression attribute and this gets rendered into javascript using unobtrusive therefore it has to validate using javascript. I failed to mention this in my initial post
You can use:
^[\x00-\x7F]+?#(?!.*?\.\.)(?=[\x01-\x7F]+$)[^#]+$
You can just use this regex
^[\x00-\x7F-[#]]*?#(?!.*?\.\.)[\x00-\x7F-[#]]+$
Or, if you want to match at least 1 character before #:
^[\x00-\x7F]+#(?!.*?\.\.)[\x00-\x7F-[#]]+$
Mind that [\x00-\x7F] also includes # symbol. In C# regex, we can subtract this from the range using -[#] inside the character class.
And you do not need the anchors since you are using this in a RegularExpressionAttribute, I believe.
Here is a demo on regexstorm.net, remove the second #, and you will have a match.

Profile View Filters Request URI

I'm trying to "Include Only" about 40 URLs for a specific profile view. I set up three Request URI filters that use "Include Only" and the following regex:
FIRST:
/(subdirectory1|subdirectory2|subdirectory3|subdirectory4)/
(That goes on and on for about 15 subdirectories)
SECOND:
/(subdirectory16|subdirectory17|subdirectory18|subdirectory19)/
(That goes on and on for another 15 subdirectories).
THIRD:
Same thing for whatever remains.
If I only have ONE "Include Only" Request URI filter set up this way, it works. As soon as I add a second filter, it stops tracking everything. Unfortunately, I can't fit all URLs in the one filter.
How can I accomplish this?
Thanks.
The first filter includes the subdirectories 1-15 (if numbered sequentially). Everything else is thrown away. The second filter works on what is left, so from the sequence subdirectory1 to subdirectory15 it only includes those that match the pattern subdirectory16-subdirectory25. Which is none of them.
Filters are applied in the order that they are defined and they are destructive, data that has been deleted in a previous filter is not evaluated in a subsequent filter, hence you see nothing.
An standard include filter does not accept regular expressions (whith the exception of the "|" character). However as far as I know (and according to the documentation) the advanced include filter does.
I'm not great with regular expression, but the following pattern should work or at least be good enough to get you going:
\/subdirectory([1-2][1-9]|[1-9])
The first bit is your directory name. The bit in parenthesis should match the numbers. Specifically:
[1-2][1-9]
should match numbers from 11 to 29 (these are character classes, regex treats numbers as characters not as numbers. So this bit looks for something that starts with 1 or two and is followed by one of the numbers 1,2,3,4,5,6,7,8,9).
Then there is your "or"-sign and a second expression to match numbers that have only one digit.
Change the character classes according to your needs.
You'd have to go from predefined to advanced filter, set "include", use "RequestURI" as filter field and enter the expression. That should work (I admit I haven't tested it).

How to convert DetailsView columns to uppercase

I need to be able to convert all input fields in a DetailsView (Insert) to uppercase. How do I do this? My SQL query and the whole insert statement takes place in ASP.NET, and not in code behind so I'm not sure if I can dynamically do this in ASP.
I've used Text-Transform in CSS to make them look uppercase for the user, but it still enters the details in lower case in the field.
Done a cheeky work around - the SQL query simply converts everything to upper case now.

Comma Separated check in asp.net

How to search every word separated by comma in textbox
Please refer above post
Its Working perfectly...But i have small issues.. when i enter in text box like c,c++,4-5 yrs it have to check in database like either c,c++ skills and 4-5 yrs experiecne and then the reult has to be shown... Burt as per ur query it just show results whether any one of keyword satisfy database ...I want to compare year also how? –
If you want that behavior, you have to program that behavior. One design is to have multiple input boxes: one where you check if any of the words exist, another where you check that all of the words exist. (Perhaps even another for an exact phrase match.) Another design possibility would be for you to develop a syntax to indicate optional and required words all within a single input box. The point is it is up to you.
After you've decided on a design, then you could write code that builds your query based on or matches on the optional words and and matches on the required. Something like this pseudocode
Select * From Table Where
(Field Like OptionalWord1 Or Field Like OptionalWord2 Or Field Like OptionalWord3)
And Field Like RequiredWord1
And Field Like RequiredWord2
(etc.)

Resources