-1

正規表現などが必要です。次のパターンの一連の文字列があります。

S 8010-Y30R
7020-R
S 7020-R
3852-R10B

これらを注文する必要があります:

By the last letter in the order: Y R B G
Then by the last two digits
Then by the second last letter (if any) in the order: Y R B G
Then by the two digits
Then by the first two digits

したがって、例:S 8010-Y30R would be ordered by: R 30 Y 10 80
2番目の例:7020-R is a short version of: S 7020-R _ _ _

これらをExcelで注文するか、JavaScriptを使用して2つの配列を並べ替えることができます(1つは上記のカラーコードを含み、もう1つは同じRGBバージョンを含みます)。

4

1 に答える 1

0

これを試して:

 Search string  
    ^[A-Z]? ?(\d\d)(\d\d)-([A-Z]?)(\d\d)?([A-Z])?$
 Replace string 
    $5$4$3$2$1

これは、常に発生する項目がハイフンの前の 4 桁であり、ハイフン自体であると想定しています。他のすべてはオプションであり、最初の文字を保持したくありません。各文字列は、1 行に単独で出現します。

于 2013-01-14T08:24:05.953 に答える